SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A class used to register, trigger and remove events on both DOM and Javascript objects. Uses the singleton design pattern. To enforce one single instance we use an anonymous constructor.
Constructor Summary | |
IWEventManager()
|
Method Summary | |
IWEventListener
|
addCustomListener(obj, eventName, eventHandler)
Registers a handler for the given custom event name and object. |
IWEventListener
|
addDomListener(obj, eventName, eventHandler)
Registers a handler for the given DOM event name and object. If possible the W3C or Microsoft syntax for attaching events will be used, otherwise an IW event handler is registered. |
IWEventListener
|
addListener(obj, eventName, eventHandler)
Registers a handler for the given event name and object. This method is deprecated, use addDomListener in case of a DOM event or addCustomListener otherwise. |
IWEventListener
|
bind(obj, eventName, listenerObj, eventHandler)
Registers a method from an object as handler for events of the specified type from another object. |
void
|
clearInstanceListeners(obj)
Removes all registered handlers for the given object. |
void
|
clearListeners(obj, eventName)
Removes all handlers for the specified event type and object. |
void
|
removeListener(eventListener)
Removes the handler determined by the specified reference. |
void
|
trigger(object, eventName, event)
Triggers the event on the given object. |
Constructor Detail |
IWEventManager()
Method Detail |
IWEventListener addCustomListener(obj, eventName, eventHandler)
Object obj
- the object firing the event
String eventName
- the name of the event
Function eventHandler
- the listener function to register
IWEventListener
the listener object which can be used to remove the handler
IWEventListener addDomListener(obj, eventName, eventHandler)
Object obj
- the object firing the event
String eventName
- the name of the event
Function eventHandler
- the listener function to register
IWEventListener
the listener object which can be used to remove the handler
IWEventListener addListener(obj, eventName, eventHandler)
This method is deprecated, use addDomListener in case of a DOM event or addCustomListener otherwise.
Object obj
- the object firing the event
String eventName
- the name of the event
Function eventHandler
- the listener function to register
IWEventListener
the listener object which can be used to remove the handler
IWEventListener bind(obj, eventName, listenerObj, eventHandler)
Object obj
- the object firing the event
String eventName
- the name of the event
Object listenerObj
- the object listening to the event
Function eventHandler
- the listener function to register
IWEventListener
void clearInstanceListeners(obj)
Object obj
void
void clearListeners(obj, eventName)
Object obj
- an object with registered events
String eventName
- the name of the event to unregister
void
void removeListener(eventListener)
IWEventListener eventListener
- the event listener to remove
void
void trigger(object, eventName, event)
Object object
- the object triggering this event
String eventName
- the name of this event
Object event
- the event object
void