Loader
Module | ejs |
Definition | class Loader |
Inheritance | Loader Object |
Specified | ejscript-2.5 |
Stability | Prototype. |
CommonJS loader class.
This is public do assist dynamic loading of ejs.cjs so namespace qualification is not needed.
Properties
Qualifiers | Property | Type | Description |
static | initializers | | null |
static | mainId | | null |
static | signatures | | null |
Inherited Properties
Loader Class Methods
Inherited Methods
Loader Instance Methods
Qualifiers | Method |
(No own instance methods defined)
Inherited Methods
Method Detail
- Description
- Load a CommonJS module and return the exports object. After the first load, the script module will be compiled
and cached as a byte-code module. It will be recompiled if the script source is modified or missing.
- Parameters
id: String | Unique name of the module to load. The id may be a unique ID, an absolute path, relative path or a path fragment that is resolved relative to the App search path. Ids may or may not include a ".es" or ".js" extension. |
path: Path | Optional path to the physical file corresponding to the module. If the module source code has changed, it will be re-compiled and then cached. |
codeReader: Function | Optional function to provide script code to use instead of reading from the path. [default: null] |
config | null [default: expression] |
- Returns
- A hash of exported properties.
- Description
- Register a CommonJS module initializer.
- Parameters
id | Unique path ID for the module. This is typically a relative path to the module. |
fn | Module initialization function. |
- Returns
- The function.
- Description
- Load a CommonJS module. The module is loaded only once unless it is modified.
WARNING: this will not be supported in future releases as the Harmony loader will be supported instead.
- Parameters
id: String | Name of the module to load. The id may be an absolute path, relative path or a path fragment that is resolved relative to the App search path. Ids may or may not include a ".es" or ".js" extension. |
config: Object | null [default: expression] |
- Returns
- A hash of exported properties `.
- Description
- Set the configuration options hash for require to use. Loader uses the config.extensions field to
determine the eligible file extensions to use when searching for modules.
- Parameters
newConfig: Object | Configuration options hash. |