on(...)
Studio is being deprecated, please head over to the documentation page for Mattercraft, our most advanced 3D tool for the web, where you can find the most recent information and tutorials.
on(evt : string, func : (...params : any[]) => void) : this;
Attaches a handler function to an event.
Parameters
Section titled “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
Section titled “Returns”this
Example
Section titled “Example”myobject.on("pointerdown", myHandler);
function myHandler() { // This function is called when the user taps on myobject}