MCPcopy
hub / github.com/angular/angular / addToQueue

Method addToQueue

packages/core/src/defer/timer_scheduler.ts:86–104  ·  view source on GitHub ↗
(
    target: Array<number | VoidFunction>,
    invokeAt: number,
    callback: VoidFunction,
  )

Source from the content-addressed store, hash-verified

84 }
85
86 private addToQueue(
87 target: Array<number | VoidFunction>,
88 invokeAt: number,
89 callback: VoidFunction,
90 ) {
91 let insertAtIndex = target.length;
92 for (let i = 0; i < target.length; i += 2) {
93 const invokeQueuedCallbackAt = target[i] as number;
94 if (invokeQueuedCallbackAt > invokeAt) {
95 // We've reached a first timer that is scheduled
96 // for a later time than what we are trying to insert.
97 // This is the location at which we need to insert,
98 // no need to iterate further.
99 insertAtIndex = i;
100 break;
101 }
102 }
103 arrayInsert2(target, insertAtIndex, invokeAt, callback);
104 }
105
106 private removeFromQueue(target: Array<number | VoidFunction>, callback: VoidFunction) {
107 let index = -1;

Callers 2

addMethod · 0.95
callbackMethod · 0.95

Calls 1

arrayInsert2Function · 0.90

Tested by

no test coverage detected