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()
add(subject, promise): voidAdds 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
| Parameter | Type | Description |
|---|---|---|
subject | SchedulerSubject | The observable or subscriber to add work to |
promise | PromiseLike<void> | The work to be added, represented as a promise |
Returns
void
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
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
schedule()
schedule(subject, action): voidSchedules 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
| Parameter | Type | Description |
|---|---|---|
subject | SchedulerSubject | The observable or subscriber to schedule work for |
action | ScheduledAction<any> | The scheduled action representing the work to be executed |
Returns
void