Class GSDOMEventsMixin
A mixin class providing DOM event handling capabilities.
| Constructor Attributes | Constructor Name and Description |
|---|---|
| Method Attributes | Method Name and Description |
|---|---|
|
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified
type occurring on the component's target element.
|
|
|
removeEventListener(token)
Removes the event listener function represented by the
token parameter
from this feature |
|
|
Removes all registered event listeners from the component's target element
|
Method Detail
{Object}
addEventListener(eventType, func, scope)
Registers the given function as a handler for DOM events of the specified
type occurring on the component's target element. This function returns a token
that can be passed to the #removeEventListener to remove the event
listener. If the
scope argument is not passed the function will execute in the context
of this object
- Parameters:
- {String} eventType
- the event type to add the listener for. Can be one of:
click, mousedown, mouseup, mouseover, mouseout - {Function} func
- The function to invoke when the event is triggered
- {Object} scope Optional
- the scope (
thisreference) in which the function is executed
- Throws:
- {Error}
- if this component does not define a reference to its DOM element
- Returns:
- {Object} a token that can be passed to the GSEventManager#removeEventListener to remove the event listener.
removeEventListener(token)
Removes the event listener function represented by the
token parameter
from this feature
- Parameters:
- {Object} token
- a token identifying the event handler to be removed
removeEventListeners()
Removes all registered event listeners from the component's target element