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

Method add

packages/core/src/pending_tasks.ts:52–63  ·  view source on GitHub ↗

* Adds a new task that should block application's stability. * @returns A cleanup function that removes a task when called.

()

Source from the content-addressed store, hash-verified

50 * @returns A cleanup function that removes a task when called.
51 */
52 add(): () => void {
53 const taskId = this.internalPendingTasks.add();
54 return () => {
55 if (!this.internalPendingTasks.has(taskId)) {
56 // This pending task has already been cleared.
57 return;
58 }
59 // Notifying the scheduler will hold application stability open until the next tick.
60 this.scheduler.notify(NotificationSource.PendingTaskRemoved);
61 this.internalPendingTasks.remove(taskId);
62 };
63 }
64
65 /**
66 * Runs an asynchronous function and blocks the application's stability until the function completes.

Callers 1

runMethod · 0.95

Calls 4

addMethod · 0.65
hasMethod · 0.65
notifyMethod · 0.65
removeMethod · 0.65

Tested by

no test coverage detected