Classes
Methods
# emit(event, data)
Emit an event to all subscribers.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string
|
Event name |
data |
*
|
Data to pass to listeners |
# listenerCount(event) → {number}
Get the count of listeners for an event.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string
|
number
# on(event, callback) → {function}
Subscribe to an event.
Parameters:
| Name | Type | Description |
|---|---|---|
event |
string
|
Event name |
callback |
function
|
Listener function |
Unsubscribe function
function
# removeAllListeners(eventopt)
Remove all listeners, optionally for a specific event.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
event |
string
|
<optional> |
Event name (omit to clear all) |