Constructor
new EventEmitter()
Creates an instance of EventEmitter.
This constructor initializes the callbacks object, which is used to store event listeners.
The `base` namespace is initialized as an empty object to hold default event listeners.
- Source:
Methods
off(_names) → {EventEmitter}
Removes event listeners for one or more events.
Parameters:
Name | Type | Description |
---|---|---|
_names |
string | A string of event names separated by spaces. |
- Source:
Returns:
The current instance of EventEmitter.
- Type
- EventEmitter
on(_names, callback) → {EventEmitter}
Registers an event listener for one or more events.
Parameters:
Name | Type | Description |
---|---|---|
_names |
string | A string of event names separated by spaces. |
callback |
function | The function to be called when the event is triggered. |
- Source:
Returns:
The current instance of EventEmitter.
- Type
- EventEmitter
resolveName(name) → {Name}
Resolves a single event name into its components.
Parameters:
Name | Type | Description |
---|---|---|
name |
string | The event name. |
- Source:
Returns:
An object containing the original name, the event value, and the namespace.
- Type
- Name
resolveNames(_names) → {Array.<string>}
Resolves a string of event names into an array of individual names.
Parameters:
Name | Type | Description |
---|---|---|
_names |
string | A string of event names separated by spaces. |
- Source:
Returns:
An array of individual event names.
- Type
- Array.<string>
trigger(_name, _argsopt) → {any}
Calls all event listeners for a given event.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
_name |
string | The name of the event. | |
_args |
Array.<any> |
<optional> |
The arguments to pass to the event listeners. |
- Source:
Returns:
The result of the event listeners.
- Type
- any