Constructor
new MyEventEmitter()
Default constructor, intializes an empty object to store events
- Source:
Methods
emit(name, data)
The internal API for this class. Gets called with an event name and a data object. Any
callbacks that have been set to listen to the matching event are dispatched.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
* | |
data |
* |
- Source:
on(name, listener)
The external API for this class. Gets called with an event name and a callback function
that is fired when the event is emitted.
Parameters:
| Name | Type | Description |
|---|---|---|
name |
* | |
listener |
* |
- Source:
removeListener(name, listenerToRemove)
Function to remove a listener that was previously set
Parameters:
| Name | Type | Description |
|---|---|---|
name |
* | |
listenerToRemove |
* |
- Source: