emit(...)

emit(evt : string, ...params : any[]) : this;

Calls the handler functions attached to an event.

Parameters

Parameter Type Description
evt string The name of the event.
params function A variable-length list of parameters to pass to handler functions.

Returns

this

Example

myobject.on("customEvent", myHandler);

function myHandler(customParam : number) {
    // This function is executed when emit is called below
    // customParam has the value 5 in this instance
}

myobject.emit("customEvent", 5);
zapcode branded_zapcode i