Constructor Summary
Public Constructor | ||
public |
constructor(elementOrSelector: HTMLElement | String) |
Method Summary
Public Methods | ||
public |
destroy() Destroy this instance, removing all events and references. |
|
public |
dispatch(eventName: String, options: Object): CustomEvent Dispatch a custom event at the root element. |
|
public |
Remove an event listener. |
|
public |
Add an event listener. |
Public Constructors
public constructor(elementOrSelector: HTMLElement | String) source
Params:
Name | Type | Attribute | Description |
elementOrSelector | HTMLElement | String | The element or selector indicating the element to use as the delegation root. |
Public Methods
public dispatch(eventName: String, options: Object): CustomEvent source
Dispatch a custom event at the root element.
Params:
Name | Type | Attribute | Description |
eventName | String | The name of the event to dispatch. |
|
options | Object |
|
CustomEvent options. |
options.bubbles | Object |
|
Whether the event should bubble. |
options.cancelable | Object |
|
Whether the event should be cancelable. |
options.detail | Object |
|
Data to pass to handlers as |
public off(eventName: String, selector: String, handler: Function, useCapture: Boolean): Event source
Remove an event listener.
Params:
Name | Type | Attribute | Description |
eventName | String |
|
The event name to stop listening for, including optional namespace(s). |
selector | String |
|
The selector that was used for event delegation. |
handler | Function |
|
The function that was passed to |
useCapture | Boolean |
|
Only remove listeners with |
Return:
Event | this, chainable. |
public on(eventName: String, selector: String, handler: Function, useCapture: Boolean): Events source
Add an event listener.
Params:
Name | Type | Attribute | Description |
eventName | String | The event name to listen for, including optional namespace(s). |
|
selector | String |
|
The selector to use for event delegation. |
handler | Function | The function that will be called when the event is fired. |
|
useCapture | Boolean |
|
Whether or not to listen during the capturing or bubbling phase. |