mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Fix: setInterval callback is not fired while touch events are being processed
Resolves #2116
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
//iOS specific timer functions implementation.
|
||||
import * as utils from "utils/utils";
|
||||
|
||||
//iOS specific timer functions implementation.
|
||||
var timeoutCallbacks = new Map<number, KeyValuePair<NSTimer, TimerTargetImpl>>();
|
||||
var timerId = 0;
|
||||
|
||||
@ -52,6 +54,9 @@ function createTimerAndGetId(callback: Function, milliseconds: number, shouldRep
|
||||
let timerTarget = TimerTargetImpl.initWithCallback(callback, id, shouldRepeat);
|
||||
let timer = NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(milliseconds / 1000, timerTarget, "tick", null, shouldRepeat);
|
||||
|
||||
// https://github.com/NativeScript/NativeScript/issues/2116
|
||||
utils.ios.getter(NSRunLoop, NSRunLoop.currentRunLoop).addTimerForMode(timer, NSRunLoopCommonModes);
|
||||
|
||||
let pair: KeyValuePair<NSTimer, TimerTargetImpl> = { k: timer, v: timerTarget };
|
||||
timeoutCallbacks.set(id, pair);
|
||||
|
||||
|
Reference in New Issue
Block a user