An event object is created at the time of emit. It is passed to each listener. Listeners can modify it.
emit()
returns this event object.
Event object can be an instance of Event
or child of Event
.
Type of event.
The data that has been linked with listener (data argument of add()
).
The list of listeners return values.
Calling this function completes the bypass listeners.
Checks if stopPropagation()
has been called.
Asks the caller not to perform a default action.
function handler(e) {
if (iBusy()) {
e.preventDefault();
} else {
// pre remove
}
}
emitter->add("delete", handler);
// ...
function removeUser(userId) {
var event = emitter->emit("delete", {id: userId});
if (event.isDefaultPrevented()) {
return false;
}
// remove user
return true;
}
Checks if preventDefault()
has been called.
Note: methods name "prevent default" and "stop propagation" taken from DOM events. Here they are not entirely accurate.