MCPcopy
hub / github.com/angular/angularfire / schedule

Method schedule

src/zones.ts:46–64  ·  view source on GitHub ↗
(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any)

Source from the content-addressed store, hash-verified

44 }
45
46 schedule(work: (this: SchedulerAction<any>, state?: any) => void, delay?: number, state?: any): Subscription {
47 const targetZone = this.zone;
48 // Wrap the specified work function to make sure that if nested scheduling takes place the
49 // work is executed in the correct zone
50 const workInZone = function(this: SchedulerAction<any>, state: any) {
51 if (targetZone) {
52 targetZone.runGuarded(() => {
53 work.apply(this, [state]);
54 });
55 } else {
56 work.apply(this, [state]);
57 }
58 };
59
60 // Scheduling itself needs to be run in zone to ensure setInterval calls for async scheduling are done
61 // inside the correct zone. This scheduler needs to schedule asynchronously always to ensure that
62 // firebase emissions are never synchronous. Specifying a delay causes issues with the queueScheduler delegate.
63 return this.delegate.schedule(workInZone, delay, state);
64 }
65}
66
67@Injectable({

Callers 3

fromRefFunction · 0.80
_fromRefFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected