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

Class CustomIdleService

packages/core/test/acceptance/defer_spec.ts:2102–2123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2100 };
2101
2102 @Injectable({providedIn: 'root'})
2103 class CustomIdleService implements IdleService {
2104 private callbacks: Array<((deadline?: IdleDeadline) => void) | undefined> = [];
2105
2106 requestOnIdle(
2107 callback: (deadline?: IdleDeadline) => void,
2108 options?: IdleRequestOptions,
2109 ): number {
2110 return this.callbacks.push(callback) - 1;
2111 }
2112
2113 cancelOnIdle(id: number): void {
2114 this.callbacks[id] = undefined;
2115 }
2116
2117 trigger(): void {
2118 for (const callback of this.callbacks) {
2119 callback?.();
2120 }
2121 this.callbacks.length = 0;
2122 }
2123 }
2124
2125 TestBed.configureTestingModule({
2126 providers: [

Callers

nothing calls this directly

Calls 1

InjectableInterface · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…