MCPcopy
hub / github.com/angular/angular-cli / scheduleTargetAndForget

Function scheduleTargetAndForget

packages/angular_devkit/architect/src/api.ts:366–392  ·  view source on GitHub ↗
(
  context: BuilderContext,
  target: Target,
  overrides?: json.JsonObject,
  scheduleOptions?: ScheduleOptions,
)

Source from the content-addressed store, hash-verified

364 * @param scheduleOptions Additional scheduling options.
365 */
366export function scheduleTargetAndForget(
367 context: BuilderContext,
368 target: Target,
369 overrides?: json.JsonObject,
370 scheduleOptions?: ScheduleOptions,
371): Observable<BuilderOutput> {
372 let resolve: (() => void) | null = null;
373 const promise = new Promise<void>((r) => (resolve = r));
374 context.addTeardown(() => promise);
375
376 return from(context.scheduleTarget(target, overrides, scheduleOptions)).pipe(
377 switchMap(
378 (run) =>
379 new Observable<BuilderOutput>((observer) => {
380 const subscription = run.output.subscribe(observer);
381
382 return () => {
383 subscription.unsubscribe();
384 // We can properly ignore the floating promise as it's a "reverse" promise; the teardown
385 // is waiting for the resolve.
386 // eslint-disable-next-line @typescript-eslint/no-floating-promises
387 run.stop().then(resolve);
388 };
389 }),
390 ),
391 );
392}

Callers

nothing calls this directly

Calls 4

subscribeMethod · 0.80
addTeardownMethod · 0.65
scheduleTargetMethod · 0.65
stopMethod · 0.65

Tested by

no test coverage detected