@yantrix/automata v0.0.2 • Docs
Yantrix API / @yantrix/automata / IEventDictionary
Interface: IEventDictionary<EventType, EventMetaType>
Interface for a dictionary of events.
Extends
IAutomataExtendedEventContainer
<EventType
,EventMetaType
>
Type Parameters
• EventType extends TAutomataBaseEventType
The type of events.
• EventMetaType extends { [K in EventType]: any }
The type of event metadata.
Properties
addEvents()
ts
addEvents: (Events) => EventType[];
Add new Events to the dictionary, possibly scope them to namespace
Parameters
• Events: TEventKeysCollection
<EventType
>
Returns
EventType
[]
a list of Keys for newly added Events
clearEvents()
ts
clearEvents: (namespace?) => this;
remove all Events from the Dictionary, possibly scoping them to namespace.
Parameters
• namespace?: string
Returns
this
getDictionary()
ts
getDictionary: (namespace?) => TEventDictionaryMapping<EventType>;
Get all mapped Event Types with their corresponding Keys, possibly filtered by Namespace
Parameters
• namespace?: string
Returns
TEventDictionaryMapping
<EventType
>
getEventKeys()
ts
getEventKeys: (Events) => (null | string)[];
Get Keys of selected Events, possibly scoped to namespace
Parameters
• Events: TEventValuesCollection
<EventType
>
Returns
(null
| string
)[]
getEventValues()
ts
getEventValues: (Events) => (null | EventType)[];
Get all Events for selected Keys, possibly scoped to namespace
Parameters
• Events: TEventKeysCollection
<EventType
>
Returns
(null
| EventType
)[]
removeEvents()
ts
removeEvents: (Events) => this;
remove Events from the Dictionary, possibly scoping them to namespace.
Parameters
• Events: Partial
<TEventKeysCollection
<EventType
> & TEventValuesCollection
<EventType
>>
Returns
this
setEventValidator()
ts
setEventValidator: (eventValidator?) => this;
Sets the event validator function.
Parameters
• eventValidator?: TValidator
<EventType
>
The validator function for the event.
Returns
this
The current instance.
Inherited from
IAutomataExtendedEventContainer
.setEventValidator
validateEvent
ts
validateEvent: TValidator<EventType>;
Validator function for the event.