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

Method run

packages/core/src/pending_tasks.ts:76–84  ·  view source on GitHub ↗

* Runs an asynchronous function and blocks the application's stability until the function completes. * * ```ts * pendingTasks.run(async () => { * const userData = await fetch('/api/user'); * this.userData.set(userData); * }); * ``` * * @param fn The asynchronous functi

(fn: () => Promise<unknown>)

Source from the content-addressed store, hash-verified

74 * @developerPreview 19.0
75 */
76 run(fn: () => Promise<unknown>): void {
77 const removeTask = this.add();
78 try {
79 fn().catch(this.errorHandler).finally(removeTask);
80 } catch (err) {
81 this.errorHandler(err);
82 removeTask();
83 }
84 }
85
86 /** @nocollapse */
87 static ɵprov = /** @pureOrBreakMyCode */ /* @__PURE__ */ ɵɵdefineInjectable({

Callers

nothing calls this directly

Calls 4

addMethod · 0.95
finallyMethod · 0.80
fnFunction · 0.50
catchMethod · 0.45

Tested by

no test coverage detected