Documentation / @eventkit/base / DeferredPassthroughScheduler
Class: DeferredPassthroughScheduler
A scheduler that defers the execution of scheduled actions to a specified deferred scheduler, while still passing through work to a parent scheduler for tracking purposes.
The DeferredPassthroughScheduler
is useful in scenarios where you want to control the execution timing of actions separately from the parent scheduler, but still want to track the work within the parent scheduler's context. This is the direct scheduler that's imposed when using the #withScheduler operator.
This scheduler extends the PassthroughScheduler
, inheriting its ability to pass work through to a parent scheduler, but overrides the scheduling behavior to use a different scheduler for execution.
Extends
Implements
Constructors
Constructor
new DeferredPassthroughScheduler(
parent,
deferred,
pinningSubject?): DeferredPassthroughScheduler
Parameters
Parameter | Type |
---|---|
parent | SchedulerLike |
deferred | SchedulerLike |
pinningSubject ? | SchedulerSubject |
Returns
DeferredPassthroughScheduler
Overrides
PassthroughScheduler
.constructor
Properties
deferred
protected readonly deferred: SchedulerLike;
parent
protected readonly parent: SchedulerLike;
Inherited from
pinningSubject?
protected readonly optional pinningSubject: SchedulerSubject;
Inherited from
PassthroughScheduler
.pinningSubject
Methods
add()
add(subject, promise): void
Adds a promise that is "owned" by a subject. This means that the promise will be observed by the scheduler and will be used to determine when the subject's work has completed. If a pinning subject is provided in the constructor, the promise will also be added to that subject in the parent scheduler
Parameters
Parameter | Type | Description |
---|---|---|
subject | SchedulerSubject | The subject that "owns" the promise. |
promise | PromiseLike <void > | The promise to be added to the subject. |
Returns
void
Implementation of
Inherited from
dispose()
dispose(subject): Promise<void>
Disposes of a subject early, canceling any pending work. This is what's called when you await observable.cancel()
or await subscriber.cancel()
.
Parameters
Parameter | Type | Description |
---|---|---|
subject | SchedulerSubject | The observable or subscriber to dispose |
Returns
Promise
<void
>
A promise that resolves when disposal is complete
Implementation of
Inherited from
promise()
promise(subject): Promise<void>
Returns a promise that resolves when all work associated with the subject is complete. This is what's called when you await observable.drain()
or await subscriber
.
Parameters
Parameter | Type | Description |
---|---|---|
subject | SchedulerSubject | The observable or subscriber to wait for completion |
Returns
Promise
<void
>
A promise that resolves when all work is complete
Implementation of
Inherited from
Operators
schedule()
schedule(subject, action): void
Schedules an action that is "owned" by the subject that will be executed by the deferred scheduler instead of the parent scheduler.
Parameters
Parameter | Type | Description |
---|---|---|
subject | SchedulerSubject | The subject that "owns" the action. |
action | ScheduledAction <any > | The action to be scheduled. |
Returns
void