Skip to content

Documentation / @eventkit/base / SchedulerLike

Interface: SchedulerLike

The interface that defines the core scheduling capabilities in eventkit. A scheduler is the logical unit that coordinates all work associated with a subject.

Methods

add()

ts
add(subject, promise): void

Adds work to a subject. Work is represented as promise-like objects. A subject is considered "complete" when all of its work promises have resolved.

Parameters

ParameterTypeDescription
subjectSchedulerSubjectThe observable or subscriber to add work to
promisePromiseLike<void>The work to be added, represented as a promise

Returns

void


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


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


schedule()

ts
schedule(subject, action): void

Schedules work to be executed for a subject. This may internally call add() to add the work and orchestrate/defer/forward the work's execution if needed.

Parameters

ParameterTypeDescription
subjectSchedulerSubjectThe observable or subscriber to schedule work for
actionScheduledAction<any>The scheduled action representing the work to be executed

Returns

void

Released under the MIT License.