(task: Task)
| 34 | const tasksByHandleId: {[id: number]: Task} = {}; |
| 35 | |
| 36 | function scheduleTask(task: Task) { |
| 37 | const data = <TimerOptions>task.data; |
| 38 | data.args[0] = function () { |
| 39 | return task.invoke.apply(this, arguments); |
| 40 | }; |
| 41 | |
| 42 | const handleOrId = setNative!.apply(window, data.args); |
| 43 | |
| 44 | // Whlist on Node.js when get can the ID by using `[Symbol.toPrimitive]()` we do |
| 45 | // to this so that we do not cause potentally leaks when using `setTimeout` |
| 46 | // since this can be periodic when using `.refresh`. |
| 47 | if (isNumber(handleOrId)) { |
| 48 | data.handleId = handleOrId; |
| 49 | } else { |
| 50 | data.handle = handleOrId; |
| 51 | // On Node.js a timeout and interval can be restarted over and over again by using the `.refresh` method. |
| 52 | data.isRefreshable = isFunction(handleOrId.refresh); |
| 53 | } |
| 54 | |
| 55 | return task; |
| 56 | } |
| 57 | |
| 58 | function clearTask(task: Task) { |
| 59 | const {handle, handleId} = task.data!; |
nothing calls this directly
no test coverage detected
searching dependent graphs…