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
ScheduledAction
<any
>
Constructors
Constructor
new CleanupAction(callback): CleanupAction
Parameters
Parameter | Type | Description |
---|---|---|
callback | () => any | The function that will be called when the action is executed. |
Returns
CleanupAction
Inherited from
Methods
execute()
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
then()
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 Parameter | Default type |
---|---|
TResult1 | any |
TResult2 | never |
Parameters
Parameter | Type |
---|---|
onfulfilled ? | null | (value ) => TResult1 | PromiseLike <TResult1 > |
onrejected ? | null | (reason ) => TResult2 | PromiseLike <TResult2 > |
Returns
PromiseLike
<TResult1
| TResult2
>