Constructor
new Resources(languageopt)
Creates an instance of Resources.
Parameters:
| Name | Type | Attributes | Default | Description |
|---|---|---|---|---|
language |
string |
<optional> |
'en_US' | The language code for the desired language. Defaults to 'en_US'. |
- Source:
Methods
error(path, …params) → {string|undefined}
Retrieves an error resource at the specified path.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
path |
string | The path to the error resource. |
|
params |
any |
<repeatable> |
Additional parameters for the error resource function. |
- Source:
Returns:
The error resource or undefined if the path is not found.
- Type
- string | undefined
getPath(pathString) → {function|undefined}
Retrieves a resource at the specified path.
Parameters:
| Name | Type | Description |
|---|---|---|
pathString |
string | The path to the desired resource. |
- Source:
Throws:
-
If the specified path is not found in the resource data.
- Type
- ErrorLog
Returns:
The resource function or undefined if the path is not found.
- Type
- function | undefined
loadResources(resources)
Loads additional resources into the resource manager.
Parameters:
| Name | Type | Description |
|---|---|---|
resources |
Object | The additional resources to be loaded. |
- Source:
Throws:
-
If an error occurs while loading the resources.
- Type
- Error
templates(path, …params) → {string|function}
Retrieves a template resource at the specified path.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
path |
string | object | The path to the template resource or a template object. |
|
params |
any |
<repeatable> |
Additional parameters for the template resource function. |
- Source:
Returns:
The template resource or a rendering function if the path is found.
- Type
- string | function
text(path, …params) → {string|undefined}
Retrieves a text resource at the specified path.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
path |
string | The path to the text resource. |
|
params |
any |
<repeatable> |
Additional parameters for the text resource function. |
- Source:
Returns:
The text resource or undefined if the path is not found.
- Type
- string | undefined