Create a new event.
the parent that will be passed to listener as their this
Optional
options: EventOptionsoptions for creating this event
Readonly
subscribablePublic Subscribable that can safely be shared with consumers that should be able to listen for events.
Get if there are any listeners available.
true
if listeners are present
Emit this event asynchronously. This will invoke all of the listeners with the passed arguments. Triggering of the listeners will be done in order, waiting for a previous listener to finish before invoking the next one.
This method will not use the current ErrorStrategy and will instead reject if an error occurs.
Rest
...args: Argsarguments that the listeners will receive
Emit this event. This will invoke all of the listeners with the passed arguments. If a listener is asynchronous this will method will use the current ErrorStrategy to handle errors, and will continue to trigger listeners while the listener is handling the event.
Rest
...args: Argsarguments that the listeners will receive
Create a subscribable that will apply the specified filter to any listeners added.
function used to filter events
Rest
...args: Argsfiltered Subscription
Create an iterator that supports async iteration of events emitted.
Optional
options: EventIteratorOptionsoptions for this iterator
iterable/iterator
Monitor for changes to listeners. Only a single monitor is supported at a single time. This is intended to be used to react to if listeners are currently registered. This can be used for things such as only listening to events from other objects when this event is active.
function used to monitor for changes to listeners
Emit this event in parallel. This will invoke all of the listeners with the passed arguments. Triggering of the listeners will done in parallel.
This method will not use the current ErrorStrategy and will instead reject if an error occurs.
Rest
...args: Argsarguments that the listeners will receive
Subscribe to this event using the given listener. The listener will be invoked any time the event is emitted. The returned handle can be used to unsubscribe.
listener to subscribe
handle to the subscription, can be used to unsubscribe
Protected
subscribe0Subscribe to this event using the given listener. The listener will be invoked any time the event is emitted.
listener to subscribe
Unsubscribe a listener from this handler. The specified listener will no longer be invoked when the event is emitted.
listener to unsubscribe
Protected
unsubscribe0Unsubscribe a listener from this handler. The specified listener will no longer be invoked when the event is emitted.
listener to unsubscribe
Create a subscribable that changes the this argument used for listeners.
what should be treated as this for event listeners
modified Subscribable
Generated using TypeDoc
An event that handles subscription and fires its listeners in a synchronous fashion.
Each instance represents a single event:
The event can be emitted via the
emit
method:Listeners can be added directly on the event, but it is recommended to use
.subscribable
for any API that is public:Listeners can be unsubscribed either via their handle or via the event:
Types are fully supported and especially useful when events are used in classes: