An event emitter aggregates a few types of events.
Takes an options dictionary. See Options object.
Takes:
eventType
as string (or NULL for default event).handler
is callback for listen. See handler for more details about the callback format.data
for Event object.
Returns a listener object.
Throws Error
if eventType
is unknown (see options) or handler format is invalid.
Similarly add()
but the listener will be removed after count
calls (by default count
= 1).
Emits an event and executes all bound listeners.
Takes:
eventType
as string.event
is Event object or parameters (see emit).
Returns an Event object.
Throws Error
if eventType
is unknown (see options) or one of the listeners throwed.
Creates an event object. "Class" of event object specified in options.
If data
object is specified then event object merges with this object.
event = emitter->createEvent("click", {x: 10, y: 20});
event.type; // click
event.x; // 10
Removes all listeners of all events.
Checks if an event type is exists.
Returns a Single emitter for specified event type.
If eventType
is NULL
then returns the single emitter of default event.