FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Merge pull request #3289 from NativeScript/issue-2116 · NativeScript/NativeScript@4a109c6 · GitHub

Commit 4a109c6

Browse files
authored
Merge pull request #3289 from NativeScript/issue-2116
Fix: setInterval callback is not fired while touch events are being p…
2 parents f3e81bd + 5338484 commit 4a109c6

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

‎tns-core-modules/timer/timer.ios.ts‎

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
//iOS specific timer functions implementation.
1+
import * as utilsModule from "utils/utils";
2+
let utils: typeof utilsModule;
3+
function ensureUtils() {
4+
if (!utils) {
5+
utils = require("utils/utils");
6+
}
7+
}
8+
9+
//iOS specific timer functions implementation.
210
var timeoutCallbacks = new Map<number, KeyValuePair<NSTimer, TimerTargetImpl>>();
311
var timerId = 0;
412

@@ -51,6 +59,10 @@ function createTimerAndGetId(callback: Function, milliseconds: number, shouldRep
5159
let id = timerId;
5260
let timerTarget = TimerTargetImpl.initWithCallback(callback, id, shouldRepeat);
5361
let timer = NSTimer.scheduledTimerWithTimeIntervalTargetSelectorUserInfoRepeats(milliseconds / 1000, timerTarget, "tick", null, shouldRepeat);
62+
63+
// https://github.com/NativeScript/NativeScript/issues/2116
64+
ensureUtils();
65+
utils.ios.getter(NSRunLoop, NSRunLoop.currentRunLoop).addTimerForMode(timer, NSRunLoopCommonModes);
5466

5567
let pair: KeyValuePair<NSTimer, TimerTargetImpl> = { k: timer, v: timerTarget };
5668
timeoutCallbacks.set(id, pair);

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL