Actions

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

register(action, callback)

Registers the action

actions.register('action-to-register', () => {})

action

Type:

type action = string

The name of the action you want to register.

callback

Type:

type callback = (value) => {}

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

execute(action, value)

Executes an action

action

Type:

type action = string

The name of the action you want to execute.

value

Type:

type value = any

Provides a value to the callback.

remove(action)

Removes the action.

action

Type:

type action = string

The name of the action you want to remove.