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

Method add

packages/core/src/pending_tasks.ts:50–61  ·  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

48 * @returns A cleanup function that removes a task when called.
49 */
50 add(): () => void {
51 const taskId = this.internalPendingTasks.add();
52 return () => {
53 if (!this.internalPendingTasks.has(taskId)) {
54 // This pending task has already been cleared.
55 return;
56 }
57 // Notifying the scheduler will hold application stability open until the next tick.
58 this.scheduler.notify(NotificationSource.PendingTaskRemoved);
59 this.internalPendingTasks.remove(taskId);
60 };
61 }
62
63 /**
64 * 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