Namespace glow.events
Defined in: core.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
Handling custom events
|
| Method Attributes | Method Name and Description |
|---|---|
| <static> |
glow.events.addListeners(attachTo, name, callback, thisVal)
Convenience method to add listeners to many objects at once.
|
| <static> |
glow.events.fire(items, eventName, event)
Convenience method to fire events on multiple items at once.
|
| <static> |
glow.events.removeAllListeners(items)
Removes all listeners attached to a given object.
|
| <static> |
glow.events.removeListeners(items, eventName, callback)
|
Method Detail
<static>
glow.events.addListeners(attachTo, name, callback, thisVal)
Convenience method to add listeners to many objects at once.
If you want to add a listener to a single object, use its
'on' method.
- Parameters:
- {Object[]} attachTo
- Array of objects to add listeners to.
- {string} name
- Name of the event to listen for. Event names are case sensitive.
- {function} callback
- Function to call when the event is fired. The callback will be passed a single event object. The type of this object depends on the event (see documentation for the event you're listening to).
- {Object} thisVal Optional
- Value of 'this' within the callback. By default, this is the object being listened to.
<static>
glow.events.fire(items, eventName, event)
Convenience method to fire events on multiple items at once.
If you want to fire events on a single object, use its
'fire' method.
- Parameters:
- {Object[]} items
- Array of objects to add listeners to
- {string} eventName
- Name of the event to fire
- {glow.events.Event|Object} event Optional
- Event object to pass into listeners. You can provide a simple object of key-value pairs which will be added as properties on the glow.events.Event instance.
<static>
glow.events.removeAllListeners(items)
Removes all listeners attached to a given object.
This removes not only listeners you added, but listeners others
added too. For this reason it should only be used as part of a cleanup
operation on objects that are about to be destroyed.
- Parameters:
- {Object[]} items
- Items to remove events from
<static>
glow.events.removeListeners(items, eventName, callback)
- Parameters:
- {Object[]} items
- Items to remove events from.
- {string} eventName
- Name of the event to remove.
- {function} callback
- A reference to the original callback used when the listener was added.