EventifiedElement
Member Summary
Private Members | ||
private get |
_id: * Unique id for HtmlElement automatically generated Its solely purpose is for events tracking |
version 1.0.0 since 1.0.0 |
Method Summary
Public Methods | ||
public |
Fire an event to htmlElement. |
version 1.0.0 since 1.0.0 |
public |
Returns the callback(s) attached to element is already attached to the HtmlElement |
version 1.0.0 since 1.0.0 |
public |
Check if a listener is set for the element is already attached to the HtmlElement |
version 1.0.0 since 1.0.0 |
public |
Detach event from htmlElement node. |
version 1.0.0 since 1.0.0 |
public |
Attach event to htmlElement node. |
version 1.0.0 since 1.0.0 |
public |
registerEvents(events: Object): void Mass registering for event based on a key/callback object |
version 1.0.0 since 1.0.0 |
Private Methods | ||
private |
_callbackId(callback: *): * |
Private Members
private get _id: * version 1.0.0 since 1.0.0 source
Unique id for HtmlElement automatically generated Its solely purpose is for events tracking
Public Methods
public fire(event: String, element: window | document | node): Boolean version 1.0.0 since 1.0.0 source
Fire an event to htmlElement. It is mostly an alias to native dispatchEvent but with the option to make another element fire the event (it must be a valid target though)
Return:
Boolean | The return value is false if event is cancelable
and at least one of the event handlers which handled this event
called |
public getEvent(event: String): * version 1.0.0 since 1.0.0 source
Returns the callback(s) attached to element is already attached to the HtmlElement
Params:
Name | Type | Attribute | Description |
event | String |
|
Event name |
Return:
* |
public hasEvent(event: String, callback: String | Function): * version 1.0.0 since 1.0.0 source
Check if a listener is set for the element is already attached to the HtmlElement
Return:
* |
public off(event: String, callback: String | Function, capture: Boolean): HtmlElement version 1.0.0 since 1.0.0 source
Detach event from htmlElement node. It is mostly an alias to native removeEventListener with a storage of the registered event
public on(event: String, callback: String | Function, capture: Boolean): HtmlElement version 1.0.0 since 1.0.0 source
Attach event to htmlElement node. It is mostly an alias to native addEventListener with a storage of the registered event.
A good side effect is you cannot [duplicate callbacks with anonymous functions] (https://triangle717.wordpress.com/2015/12/14/js-avoid-duplicate-listeners).
public registerEvents(events: Object): void version 1.0.0 since 1.0.0 source
Mass registering for event based on a key/callback object
Params:
Name | Type | Attribute | Description |
events | Object | Events object to register |
Return:
void |
Private Methods
private _callbackId(callback: *): * source
Params:
Name | Type | Attribute | Description |
callback | * |
Return:
* |