Methods
(async) emit(eventName, …args) → {Promise}
- Source:
Emit an event; can be await'ed, and will resolve after all handlers have been called
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
eventName |
string | event name to emit |
|
args |
any |
<repeatable> |
arguments to pass to listeners |
Returns:
p - resolves when all listeners complete
- Type
- Promise
off(cb)
- Source:
Remove an event handler by event name
Parameters:
Name | Type | Description |
---|---|---|
cb |
function | callback |
on(matcher, cb)
- Source:
Bind an event handler
Parameters:
Name | Type | Description |
---|---|---|
matcher |
string | RegExp | regular expression or string to match with |
cb |
function | callback |
onAll(cb) → {Promise}
- Source:
Bind an event handler for all event types
Parameters:
Name | Type | Description |
---|---|---|
cb |
function | callback |
Returns:
p - resolves when all listeners complete
- Type
- Promise
onAllOnce(cb) → {Promise}
- Source:
Bind an event handler for all event types that only fires once
Parameters:
Name | Type | Description |
---|---|---|
cb |
function | callback |
Returns:
p - resolves when all listeners complete
- Type
- Promise
once(matcher, cb)
- Source:
Bind an event handler that should only fire once
Parameters:
Name | Type | Description |
---|---|---|
matcher |
string | RegExp | regular expression or string to match with |
cb |
function | callback |
removeAllListeners(matcher, negativeMatch)
- Source:
Removes all listeners, only those for the specified event name, or those matching/not matching a regular expression
Parameters:
Name | Type | Description |
---|---|---|
matcher |
string | RegExp | regular expression or string to match with |
negativeMatch |
boolean | if true, events not matching are deleted |