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
Parameter | Type | Description |
---|---|---|
callback | () => PromiseOrValue <T > | The function that will be called when the action is executed. |
Returns
CallbackAction
<T
>
Inherited from
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
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 Parameter | Default type |
---|---|
TResult1 | T |
TResult2 | never |
Parameters
Parameter | Type |
---|---|
onfulfilled ? | null | (value ) => TResult1 | PromiseLike <TResult1 > |
onrejected ? | null | (reason ) => TResult2 | PromiseLike <TResult2 > |
Returns
PromiseLike
<TResult1
| TResult2
>