Class pwlib.appEvents
An interface for adding, removing and dispatching of custom
application events.
Defined in: lib.js.
Constructor Attributes | Constructor Name and Description |
---|---|
pwlib.appEvents(target_)
|
Field Attributes | Field Name and Description |
---|---|
<private> <inner> |
Holds the list of event types and event handlers.
|
Method Attributes | Method Name and Description |
---|---|
add(type, handler)
Add an event listener.
|
|
dispatch(type, ev)
Dispatch an event.
|
|
remove(type, id)
Remove an event listener.
|
Class Detail
pwlib.appEvents(target_)
- Parameters:
- {Object} target_
- The target for all the events.
- See:
- pwlib.appEvent to create application event objects.
Field Detail
<private> <inner>
{Object}
events_
Holds the list of event types and event handlers.
Method Detail
{Number}
add(type, handler)
Add an event listener.
- Parameters:
- {String} type
- The event you want to listen for.
- {Function} handler
- The event handler.
- Throws:
- {TypeError}
- If the type argument is not a string.
- {TypeError}
- If the handler argument is not a function.
- Returns:
- {Number} The event ID.
- See:
- pwlib.appEvents#remove to remove events.
- pwlib.appEvents#dispatch to dispatch an event.
{Boolean}
dispatch(type, ev)
Dispatch an event.
- Parameters:
- {String} type
- The event type.
- {pwlib.appEvent} ev
- The event object.
- Throws:
- {TypeError}
- If the type parameter is not a string.
- {TypeError}
- If the ev parameter is not an object.
- Returns:
- {Boolean} True if the
event.preventDefault()
has been invoked by one of the event handlers, or false if not.
- See:
- pwlib.appEvents#add to add events.
- pwlib.appEvents#remove to remove events.
- pwlib.appEvent the generic event object.
remove(type, id)
Remove an event listener.
- Parameters:
- {String} type
- The event type.
- {Number} id
- The event ID.
- Throws:
- {TypeError}
- If the type argument is not a string.
- See:
- pwlib.appEvents#add to add events.
- pwlib.appEvents#dispatch to dispatch an event.