one(...)

one(evt : string, func : (...params : any[]) => void) : this;

Attaches a single-use handler function to an event. The handler will only be called the first time the event is triggered.

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.one("pointerdown", myHandler);

function myHandler() {
    // This function is called the first time the user taps on myobject
}
zapcode branded_zapcode i