Constructs the utility that allows to emit events and register event handlers.
Optional
supportedEvents: string[]event names that the are expected to be emitted
Optional
strictMode: booleanif 'true' any attempt to register a handler that is not on the supportedEvents
list
will throw an error.
Emits an event. Calling this method will cause all registered callbacks for the given event type to be invoked. Any additional parameters that are passed to this function will be passed as arguments to the callback functions.
the event type to emit
Rest
...args: any[]additional parameters that describe the emitted event
Registers a callback function for a given event type.
the event type to register on
the callback function to register
Rest
...args: any[]Optional
context: anythe context in which the callback function should be invoked implementation dependent.
a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.
Static
onRegisters a callback function on the specified target object for a given event type.
the target object
the event type to register on
the callback function to register
Optional
context: anythe context in which the callback function should be invoked implementation dependent.
a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.
Static
onceRegisters a callback function on the specified target object for a given event type. This function behaves identical to 'on' with the exception that the registered callback function will be automatically removed when it has been triggered one time.
the target object
the event type to register on
the callback function to register
Optional
context: anythe context in which the callback function should be invoked implementation dependent.
a handle to the registered callback with a single function 'remove'. This function can be used to unregister the callback function.
A utility class for objects that emit events and allow listeners to be registered on them.
EventedSupport
can be used in a prototype chain of a class to wire in the event notification system. For example, you can create a custom implementation of Store interface in order to be able to emit store specific events.