EventTrigger

EventTrigger

attach and trigger event handlers.

Constructor

new EventTrigger()

Source:

Methods

on(name, callback) → {EventTrigger}

Source:
Attach an event handler function for one or more events to target
Example
target.on("animate", function() {
	console.log("animate");
});

target.trigger("animate");
Parameters:
Name Type Description
name String event's name
callback function function to execute when the event is triggered.
Returns:
An Instance itself.
Type
EventTrigger

trigger(name, dataopt) → {EventTrigger}

Source:
execute event handler
Example
target.on("animate", function(a1, a2) {
	console.log("animate", a1, a2);
});

target.trigger("animate", [1, 2]); // log => "animate", 1, 2
Parameters:
Name Type Attributes Description
name String event's name
data function <optional>
event handler's additional parameter
Returns:
An Instance itself.
Type
EventTrigger