MCPcopy Index your code
hub / github.com/angular/angular / scheduleTask

Function scheduleTask

packages/zone.js/lib/common/timers.ts:36–56  ·  view source on GitHub ↗
(task: Task)

Source from the content-addressed store, hash-verified

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!;

Callers

nothing calls this directly

Calls 3

isNumberFunction · 0.90
isFunctionFunction · 0.90
applyMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…