Skip to content

Documentation / @eventkit/base / CallbackAction

Class: CallbackAction<T>

Represents an action that will be executed as a result of an observable yielding a value.

Extends

Type Parameters

Type Parameter
T

Constructors

Constructor

ts
new CallbackAction<T>(callback): CallbackAction<T>

Parameters

ParameterTypeDescription
callback() => PromiseOrValue<T>The function that will be called when the action is executed.

Returns

CallbackAction<T>

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
TResult1T
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.