tinymce.util.EventDispatcher
This class lets you add/remove and fire events by name on the specified scope. This makes it easy to add event listener logic to any class.
Examples
var eventDispatcher = new EventDispatcher();
eventDispatcher.on('click', function() {console.log('data');});
eventDispatcher.fire('click', {data: 123});
Summary
Methods
Name | Summary | Defined by |
---|---|---|
Fires the specified event by name. |
||
Returns true/false if the dispatcher has a event of the specified name. |
||
Returns true/false if the specified event name is a native browser event or not. |
||
Unbinds an event listener to a specific event by name. |
||
Binds an event listener to a specific event by name. |
||
Binds an event listener to a specific event by name and automatically unbind the event once the callback fires. |
Methods
has()
has(name: String): Boolean
Returns true/false if the dispatcher has a event of the specified name.
isNative()
isNative(name: String): Boolean
Returns true/false if the specified event name is a native browser event or not.
off()
off(name: String?, callback: callback?): Object
Unbinds an event listener to a specific event by name.
on()
on(name: String, callback: callback, prepend: Boolean): Object
Binds an event listener to a specific event by name.
once()
once(name: String, callback: callback, prepend: Boolean): Object
Binds an event listener to a specific event by name and automatically unbind the event once the callback fires.