Skip to content

vue-mvvm / core / ActionContext

ActionContext<T> ​

Represents the context for executing an action, allowing the action to be completed successfully or failed with an error.

This context ensures that an action transaction can only be resolved once.

Type Parameters ​

T ​

T

Methods ​

completeAction() ​

ts
completeAction(data): void;

Completes the current action and resolves it with the provided data.

Ensures that the action is not marked as complete more than once. This will also cause that a waiting ViewModel that called ViewModel.runAction will continue its execution.

Parameters ​

data ​

T

The data to be passed when resolving the action.

Returns ​

void


failAction() ​

ts
failAction(error?): void;

Completes the current action and resolves it with the provided error.

Ensures that the action is not marked as complete more than once. This will also cause that a waiting ViewModel that called ViewModel.runAction will continue its execution.

Parameters ​

error? ​

any

Optional error object or message to provide additional details about the failed action.

Returns ​

void