Skip to content

Documentation / @eventkit/base / CleanupAction

Class: CleanupAction ​

Represents an action that will be executed after some other work has been done.

Internally, CleanupAction is no different than ScheduledAction, but it's a separate class that can be identified by the scheduler to control when the action is executed. Classes that utilize a scheduler will add CleanupAction's, and the scheduler is expected to execute them when the subject's work has completed.

Extends ​

Constructors ​

Constructor ​

ts
new CleanupAction(callback): CleanupAction

Parameters ​

ParameterTypeDescription
callback() => anyThe function that will be called when the action is executed.

Returns ​

CleanupAction

Inherited from ​

ScheduledAction.constructor

Methods ​

execute() ​

ts
execute(): Promise<void>

Executes the action. This will call the callback and resolve or reject the action's promise based on the callback's return value. If the action has already been executed, this method will return a promise representing the already executed callback.

Returns ​

Promise<void>

Inherited from ​

ScheduledAction.execute


then() ​

ts
then<TResult1, TResult2>(onfulfilled?, onrejected?): PromiseLike<TResult1 | TResult2>

Returns a promise that will resolve or reject based on the callback's return value.

Type Parameters ​

Type ParameterDefault type
TResult1any
TResult2never

Parameters ​

ParameterType
onfulfilled?null | (value) => TResult1 | PromiseLike<TResult1>
onrejected?null | (reason) => TResult2 | PromiseLike<TResult2>

Returns ​

PromiseLike<TResult1 | TResult2>

Inherited from ​

ScheduledAction.then

Released under the MIT License.