nomad

@lacrypta/nomad v0.0.0 / EventCaster

Interface: EventCaster

Glob-enabled Event Caster interface.

This event caster allows listeners to be attached to “glob” expressions. All event names must adhere to the following ABNF:

segment = 1*( ALPHA / DIGIT / "/" / "_" / "." / "-" )
event-name = segment *( ":" segment )

.

An event name filter may use the following wildcards in lieu of a segment, with the restriction that no two consecutive filter segment may contain a “**” wildcard. Their expected meanings are as follows:

This yields the following ABNF for a filter proper:

filter = ( ( segment / "*" ) [ ":" filter ] / "**" [ ":" segment [ ":" filter ] ] )

Extended by

Methods

off()

off(callback: EventCallback): this

Remove the given callback from the listeners set.

Parameters

callback: EventCallback

The callback to remove.

Returns

this

this, for chaining.

Defined in

eventCaster.ts:120


on()

on(filter: string, callback: EventCallback): this

Attach the given callback to the EventCaster, triggered on events matching the given filter.

Parameters

filter: string

Event name filter to assign the listener to.

callback: EventCallback

Callback to call on a matching event being cast.

Returns

this

this, for chaining.

Defined in

eventCaster.ts:129


once()

once(filter: string, callback: EventCallback): this

Attach the given callback to the EventCaster, triggered on events matching the given filter, and removed upon being called once.

Parameters

filter: string

Event name filter to assign the listener to.

callback: EventCallback

Callback to call on a matching event being cast.

Returns

this

this, for chaining.

Defined in

eventCaster.ts:138