| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff 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. | ||
| 2 | 10 | var timeoutCallbacks = new Map<number, KeyValuePair<NSTimer, TimerTargetImpl>>(); | |
| 3 | 11 | var timerId = 0; | |
| 4 | 12 | ||
@@ -51,6 +59,10 @@ function createTimerAndGetId(callback: Function, milliseconds: number, shouldRep | |||
| 51 | 59 | let id = timerId; | |
| 52 | 60 | let timerTarget = TimerTargetImpl.initWithCallback(callback, id, shouldRepeat); | |
| 53 | 61 | 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); | ||
| 54 | 66 | ||
| 55 | 67 | let pair: KeyValuePair<NSTimer, TimerTargetImpl> = { k: timer, v: timerTarget }; | |
| 56 | 68 | timeoutCallbacks.set(id, pair); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments