Skip to content

one(...)

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.

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.

ParameterTypeDescription
evtstringThe name of the event to attach to.
funcfunctionThe function to be called when the event is triggered.

this

myobject.one("pointerdown", myHandler);
function myHandler() {
// This function is called the first time the user taps on myobject
}