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

Method execute

packages/service-worker/worker/src/idle.ts:68–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

66 }
67
68 async execute(): Promise<void> {
69 this.lastRun = this.adapter.time;
70 while (this.queue.length > 0) {
71 const queue = this.queue;
72 this.queue = [];
73
74 await queue.reduce(async (previous, task) => {
75 await previous;
76 try {
77 await task.run();
78 } catch (err) {
79 this.debug.log(err as Error, `while running idle task ${task.desc}`);
80 }
81 }, Promise.resolve());
82 }
83
84 if (this.emptyResolve !== null) {
85 this.emptyResolve();
86 this.emptyResolve = null;
87 }
88 this.empty = Promise.resolve();
89 this.oldestScheduledAt = null;
90 }
91
92 schedule(desc: string, run: () => Promise<void>): void {
93 this.queue.push({desc, run});

Callers 1

triggerMethod · 0.95

Calls 4

reduceMethod · 0.80
runMethod · 0.65
logMethod · 0.65
resolveMethod · 0.65

Tested by

no test coverage detected