Returns whether this instance has already been destroyed.
Is destroyed state.
Returns the name associated with this instance.
The target eventbus name.
Returns the options of an event name.
Event name(s) to verify.
The event options.
Returns an iterable for the event names / keys of registered event listeners along with event options.
Optional
regex: RegExpOptional regular expression to filter event names.
Generator
Trigger callbacks for the given event, or space-delimited list of events. Subsequent arguments to trigger will be passed along to the event callbacks.
Event name(s)
Rest
...args: any[]Additional arguments passed to the event function(s).
This instance.
Provides trigger
functionality, but collects any returned Promises from invoked targets and returns a
single Promise generated by Promise.resolve
for a single value or Promise.all
for multiple results. This is
a very useful mechanism to invoke asynchronous operations over an eventbus.
Event name(s)
Rest
...args: any[]Additional arguments passed to the event function(s).
A Promise to returning any results.
Defers invoking trigger
. This is useful for triggering events in the next clock tick.
Event name(s)
Rest
...args: any[]Additional arguments passed to the event function(s).
This EventbusProxy.
Provides trigger
functionality, but collects any returned result or results from invoked targets as a single
value or in an array and passes it back to the callee in a synchronous manner.
Event name(s)
Rest
...args: any[]Additional arguments passed to the event function(s).
An Array of returned results.
Static
initializeCreates the EventbusSecure instance with an existing instance of Eventbus. An object / EventbusSecureObj is returned with an EventbusSecure reference and two functions for controlling the underlying Eventbus reference.
destroy()
will destroy the underlying Eventbus reference.
setEventbus(<eventbus>)
will set the underlying reference.
The target eventbus instance.
Optional
name: stringIf a name is provided this will be used instead of eventbus name.
The control object which contains an EventbusSecure reference and control functions.
EventbusSecure provides a secure wrapper around another Eventbus instance.
The main use case of EventbusSecure is to provide a secure eventbus window for public consumption. Only events can be triggered, but not registered / unregistered.
You must use the initialize method passing in an existing Eventbus instance as the eventbus reference is private. In order to secure the eventbus from unwanted access there is no way to access the eventbus reference externally from the EventbusSecure instance. The initialize method returns an EventbusSecureObj object which contains two functions to control the secure eventbus externally;
destroy
andsetEventbus
. Expose to end consumers just theeventbusSecure
instance.