Merge pull request #3389 from NativeScript/issue-2116

Fix: setInterval callback is not fired while touch events are being p…
This commit is contained in:
Rossen Hristov
2017-01-03 10:52:51 +02:00
committed by GitHub

View File

@@ -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);