MCPcopy Create free account
hub / github.com/angular/angular / onIdle

Function onIdle

packages/core/src/di/inject_async.ts:144–154  ·  view source on GitHub ↗
(options?: {timeout?: number})

Source from the content-addressed store, hash-verified

142 * @publicApi 22.0
143 */
144export function onIdle(options?: {timeout?: number}): Promise<void> {
145 if (ngDevMode) {
146 assertInInjectionContext(onIdle);
147 }
148
149 const idleService = inject(IDLE_SERVICE);
150 const {promise, resolve} = promiseWithResolvers<void>();
151 idleService.requestOnIdle(() => resolve(), options);
152
153 return promise;
154}

Callers 1

Calls 5

assertInInjectionContextFunction · 0.90
injectFunction · 0.90
promiseWithResolversFunction · 0.90
requestOnIdleMethod · 0.65
resolveFunction · 0.50

Tested by

no test coverage detected