Skip to content

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

ts
new DeferredPassthroughScheduler(
   parent, 
   deferred, 
   pinningSubject?): DeferredPassthroughScheduler

Parameters

ParameterType
parentSchedulerLike
deferredSchedulerLike
pinningSubject?SchedulerSubject

Returns

DeferredPassthroughScheduler

Overrides

PassthroughScheduler.constructor

Properties

deferred

ts
protected readonly deferred: SchedulerLike;

parent

ts
protected readonly parent: SchedulerLike;

Inherited from

PassthroughScheduler.parent


pinningSubject?

ts
protected readonly optional pinningSubject: SchedulerSubject;

Inherited from

PassthroughScheduler.pinningSubject

Methods

add()

ts
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

ParameterTypeDescription
subjectSchedulerSubjectThe subject that "owns" the promise.
promisePromiseLike<void>The promise to be added to the subject.

Returns

void

Implementation of

SchedulerLike.add

Inherited from

PassthroughScheduler.add


dispose()

ts
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

ParameterTypeDescription
subjectSchedulerSubjectThe observable or subscriber to dispose

Returns

Promise<void>

A promise that resolves when disposal is complete

Implementation of

SchedulerLike.dispose

Inherited from

PassthroughScheduler.dispose


promise()

ts
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

ParameterTypeDescription
subjectSchedulerSubjectThe observable or subscriber to wait for completion

Returns

Promise<void>

A promise that resolves when all work is complete

Implementation of

SchedulerLike.promise

Inherited from

PassthroughScheduler.promise

Operators

schedule()

ts
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

ParameterTypeDescription
subjectSchedulerSubjectThe subject that "owns" the action.
actionScheduledAction<any>The action to be scheduled.

Returns

void

Implementation of

SchedulerLike.schedule

Overrides

PassthroughScheduler.schedule

Released under the MIT License.