Constructor
new Resources(sources)
Creates an instance of Resources.
Initializes loaders and starts loading resources.
Parameters:
Name | Type | Description |
---|---|---|
sources |
Array.<Source> | Array of Source instances describing each resource to load. |
Extends
Methods
getResource(name) → {any}
Retrieves a loaded resource by its name.
The name can be a string or a value from the ResourceNames enum.
Parameters:
Name | Type | Description |
---|---|---|
name |
ResourceNames | string | The name of the resource to retrieve. |
Returns:
- The loaded resource, or undefined if not found.
- Type
- any
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. |
- Overrides:
- 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. |
- Overrides:
- 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. |
- Overrides:
- 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. |
- Overrides:
- 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. |
- Overrides:
- Source:
Returns:
The result of the event listeners.
- Type
- any