Actions
Allows to register actions that can be reused throughout your code.
register(action, callback)
Section titled “register(action, callback)”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}`);});action
Section titled “action”Type:
type action = stringThe name of the action you want to register.
callback
Section titled “callback”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.
execute(action, value)
Section titled “execute(action, value)”Executes an action. If the action is not registered, it will log an error to the console.
actions.execute('action-to-register', 'Hello World!');action
Section titled “action”Type:
type action = stringThe name of the action you want to execute.
value (optional)
Section titled “value (optional)”Type:
type value = anyProvides a value to the callback.
remove(action)
Section titled “remove(action)”Removes the action. If the action is not registered, it will log an error to the console.
actions.remove('action-to-register');action
Section titled “action”Type:
type action = stringThe name of the action you want to remove.