Event dispatcher with ability to detect whenever a property is changed.
add
prop
[value=null]
[readOnly=false]
Add a new property to allow deteching
The instance for chaining
get
prop
Generic setter for an option
prop
String
The option name
The value of the option
has
name
[callback]
Checks if the EventDispatcher has a specific listener or any listener for a given event.
If the EventDispatcher has the specified listener.
off
name
callback
Remove the event listener
Return this EventDispatcher for chaining calls.
on
name
callback
[priority=0]
Add an event listener. The parameters for the listener functions depend on the event.
name
String | Object
The type of event (can be multiple events separated by spaces), or a map of events to handlers
callback
Function | Array*
The callback function when event is fired or an array of callbacks.
[priority=0]
Int
optional
The priority of the event listener. Higher numbers are handled first.
Return this EventDispatcher for chaining calls.
once
name
callback
[priority=0]
Add an event listener but only handle it one time.
name
String | Object
The type of event (can be multiple events separated by spaces), or a map of events to handlers
callback
Function | Array*
The callback function when event is fired or an array of callbacks.
[priority=0]
Int
optional
The priority of the event listener. Higher numbers are handled first.
Return this EventDispatcher for chaining calls.
readOnly
prop
Turn on read-only for properties
prop
String
multiple
The property or properties to make readonly
The instance for chaining
respond
name
responder
Whenever a property is get a responder is called
The instance for chaining
set
prop
value
Generic setter for an option
prop
String
The property name
value
Mixed
The value to set
trigger
type
arguments
Dispatch an event
type
String
The type of event to trigger
arguments
Additional parameters for the listener functions.