(deadline?: IdleDeadline)
| 102 | |
| 103 | const key = getIdleRequestKey(options); |
| 104 | const callback = (deadline?: IdleDeadline) => { |
| 105 | // Keep idleId set during the drain to prevent re-entrant add() from scheduling redundant callbacks. |
| 106 | for (const cb of bucket.queue) { |
| 107 | cb(); |
| 108 | // _tick here is an optimized change detection check and is safe to call here. |
| 109 | // We also account for the time it takes to run change detection |
| 110 | // for the newly-created view as a part of the same idle callback. |
| 111 | this.applicationRef._tick(); |
| 112 | bucket.queue.delete(cb); |
| 113 | this.callbackBucket.delete(cb); |
| 114 | |
| 115 | if (deadline && deadline.timeRemaining() === 0 && !deadline.didTimeout) { |
| 116 | break; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | bucket.idleId = null; |
| 121 | |
| 122 | if (bucket.queue.size > 0) { |
| 123 | this.scheduleBucket(bucket, options); |
| 124 | } else { |
| 125 | this.buckets.delete(key); |
| 126 | } |
| 127 | }; |
| 128 | |
| 129 | // Ensure that the callback runs in the NgZone since |
| 130 | // the `requestIdleCallback` is not currently patched by Zone.js. |
nothing calls this directly
no test coverage detected