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

Method runTask

packages/core/src/zone/ng_zone.ts:250–258  ·  view source on GitHub ↗

* Executes the `fn` function synchronously within the Angular zone as a task and returns value * returned by the function. * * Running functions via `runTask` allows you to reenter Angular zone from a task that was executed * outside of the Angular zone (typically started via {@link #run

(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any[], name?: string)

Source from the content-addressed store, hash-verified

248 * If a synchronous error happens it will be rethrown and not reported via `onError`.
249 */
250 runTask<T>(fn: (...args: any[]) => T, applyThis?: any, applyArgs?: any[], name?: string): T {
251 const zone = (this as any as NgZonePrivate)._inner;
252 const task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
253 try {
254 return zone.runTask(task, applyThis, applyArgs);
255 } finally {
256 zone.cancelTask(task);
257 }
258 }
259
260 /**
261 * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not

Callers

nothing calls this directly

Implementers 1

NoopNgZonepackages/core/src/zone/ng_zone.ts

Calls 3

scheduleEventTaskMethod · 0.65
runTaskMethod · 0.65
cancelTaskMethod · 0.65

Tested by

no test coverage detected