CAPH.APP.EVENT.PERFEVENTHANDLER
PerfEventHandler is a small class that provides event handling functions. Main APIs of PerfEventHandler are 'addEventListener', 'removeEventListener' and 'dispatchEvent.' The addEventListener method allows you to associate a listener function on a particular type of event on an object. The removeEventListener method allows you to remove a listener function on a particular type of event from an object. The dispatchEvent method allows you to send/pass a custom event to a target object.
Contents
Constructor
PerfEventHandler | ||
Description | ||
Construct a PerfEventHandler. | ||
Emulator Support | Y | |
SDK Constraint | None | |
Example | ||
var EventHandler = caph.app.event.PerfEventHandler; var eventhandler = new EventHandler(); |
Methods
PerfEventHandler | ||
Description | ||
(Constructor) Construct a PerfEventHandler. | ||
Parameters | ■Void | |
Return | ■Object - Object, an instance of an PerfEventHandler | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var EventHandler = caph.app.event.PerfEventHandler; var eventhandler = new EventHandler(); |
addEventListener | ||
Description | ||
This function allows you to associate a listener function on a particular type of event on an object. | ||
Parameters | ■type - String - event type can be anyone of the following types : blur/resize/touchmove/touchstart/touchend/click ■data - Function - data to be transferred to the listener | |
Return | ■Object - PerfEventHandler, PerfEventHandler itself | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var EventHandler = caph.app.event.PerfEventHandler; var eventhandler = new EventHandler(); function foo() { console.log('in function foo'); } eventhandler.addEventListner('click', foo); eventhandler.dispatchEvent('click', 'foofoo'); |
dispatchEvent | ||
Description | ||
EventHandler 'dispatchEvent' method allows you to send/pass a custom event to a target object. | ||
Parameters | ■type - String - event type can be anyone of the following types : blur/resize/touchmove/touchstart/touchend/click ■listener - Function - The event listener to be added | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var EventHandler = caph.app.event.PerfEventHandler; var eventhandler = new EventHandler(); function foo() { console.log('in function foo'); } eventhandler.addEventListner('click', foo); eventhandler.dispatchEvent('click', 'foofoo'); |
removeEventListener | ||
Description | ||
removeEventListener method allows you to remove a listener function on a particular type of event from an object. | ||
Parameters | ■type - String - event type can be anyone of the following types : blur/resize/touchmove/touchstart/touchend/click ■listener - Function - The event listener to be added | |
Return | ■Void | |
Emulator Support | Y | |
SDK Constraint | none | |
Example | ||
var EventHandler = caph.app.event.PerfEventHandler; var eventhandler = new EventHandler(); function foo() { console.log('in function foo'); } eventhandler.addEventListner('click', foo); eventhandler.dispatchEvent('click', 'foofoo'); eventhandler.removeEventListner('click', foo); |