Skip to content

@yantrix/automata v0.5.2 • Docs


Yantrix API / @yantrix/automata / IActionDictionary

Interface: IActionDictionary<ActionType, PayloadType> ​

Interface for a dictionary of actions.

Extends ​

Type Parameters ​

• ActionType extends TAutomataBaseActionType

The type of actions.

• PayloadType extends { [K in ActionType]: any }

The type of payloads for each action.

Properties ​

addActions() ​

ts
addActions: (actions) => ActionType[];

Add new Actions to the dictionary, possibly scope them to namespace

Parameters ​

• actions: TActionKeysCollection<ActionType>

Returns ​

ActionType[]

a list of Keys for newly added Actions


clearActions() ​

ts
clearActions: (namespace?) => this;

remove all Actions from the Dictionary, possibly scoping them to namespace.

Parameters ​

• namespace?: string

Returns ​

this


getActionKeys() ​

ts
getActionKeys: (actions) => (null | string)[];

Get Keys of selected Actions, possibly scoped to namespace

Parameters ​

• actions: TActionValuesCollection<ActionType>

Returns ​

(null | string)[]


getActionValues() ​

ts
getActionValues: (actions) => (null | ActionType)[];

Get all Actions for selected Keys, possibly scoped to namespace

Parameters ​

• actions: TActionKeysCollection<ActionType>

Returns ​

(null | ActionType)[]


getDictionary() ​

ts
getDictionary: (namespace?) => TActionDictionaryMapping<ActionType>;

Get all mapped Action Types with their corresponding Keys, possibly filtered by Namespace

Parameters ​

• namespace?: string

Returns ​

TActionDictionaryMapping<ActionType>


removeActions() ​

ts
removeActions: (actions) => this;

remove Actions from the Dictionary, possibly scoping them to namespace.

Parameters ​

• actions: Partial<TActionKeysCollection<ActionType> & TActionValuesCollection<ActionType>>

Returns ​

this


setActionValidator() ​

ts
setActionValidator: (actionValidator?) => this;

Sets the action validator function.

Parameters ​

• actionValidator?: null | TValidator<ActionType>

The validator function for the action.

Returns ​

this

The current instance.

Inherited from ​

IAutomataExtendedActionContainer.setActionValidator


validateAction ​

ts
validateAction: TValidator<ActionType>;

Validator function for the action.

Inherited from ​

IAutomataExtendedActionContainer.validateAction