Skip to content

Actions

Allows to register actions that can be reused throughout your code.

Registers an action. If the action is already registered, it will log an error to the console.

actions.register('action-to-register', (value: any) => {
console.log(`The value is ${value}`);
});

Type:

type action = string

The name of the action you want to register.

Type:

type callback = (value: any) => void;

The callback to be executed on this action. The arguments for the callback are provided from the execute method.

Executes an action. If the action is not registered, it will log an error to the console.

actions.execute('action-to-register', 'Hello World!');

Type:

type action = string

The name of the action you want to execute.

Type:

type value = any

Provides a value to the callback.

Removes the action. If the action is not registered, it will log an error to the console.

actions.remove('action-to-register');

Type:

type action = string

The name of the action you want to remove.