on(...)
on(evt : string, func : (...params : any[]) => void) : this;
Attaches a handler function to an event.
Parameters
Parameter | Type | Description |
---|---|---|
evt | string | The name of the event to attach to. |
func | function | The function to be called when the event is triggered. |
Returns
this
Example
myobject.on("pointerdown", myHandler);
function myHandler() {
// This function is called when the user taps on myobject
}