The constructor will perform necessary preparations, so that failures can be processed with system events. Up until these preparations are complete, the failure will result in thrown standard Error.
Behaviors to add.
Callback for error handling during delayed execution after loader has loaded. Takes error string as an argument.
System options.
Error list.
Error message.
Contains system info.
Protected entrypoints.
Public entrypoints.
Contains data shared between the subsystems.
Subsystem.
Contains subsystem data.
Adds an error to the System dynamically
Error code
Error description
Adds a behavior bound to "this".
Behavior name.
Behavior.
Access stderr
Gets file contents.
Usage
// Load files
var grapefruitJuicer = Loader.getFile("c:\machines", "appliances", "grapefruitJuicer.txt");
// Output the result
grapefruitJuicer.then(function(result){ // grapefruitJuicer - on resolve
console.log(result);
}, function(error){ // grapefruitJuicer - on reject
console.error("Could not load a file.");
});
// Input - grapefruitJuicer.txt
// 1000W powerful juicer
// Output
// 1000W powerful juicer
Absolute root directory.
Directory relative to root.
Full file name.
File contents.
Checks if is a directory.
Usage
// Verify directory
Loader.isDir("c:\machines\appliances","grapefruitJuicer.txt").then(function(result){
console.log(result);
});
// Input - grapefruitJuicer.txt
// 1000W powerful juicer
// Output
// false
Absolute root directory.
Relative directory to root.
Returns true
if a directory, false
if not.
Checks if is a file
Usage
// Verify file
Loader.isFile("c:\machines\appliances\grapefruitJuicer.txt").then(function(result){
console.log(result);
});
// Input - grapefruitJuicer.txt
// 1000W powerful juicer
// Output
// true
Full filepath.
Returns true
if a file, false
if not.
Join a root directory with a file/folder or an array of files/folders to absolute path.
Usage
// Join and log result
console.log(Loader.join("c:\machines", "appliances"))
// Output
// c:\machines\appliances
File/folder name|names.
Absolute path|paths.
Returns an array of strings, representing the contents of a folder.
Usage
// List directory contents
Loader.list("c:","machines").then(function(result){
console.log(result);
}, function(error){
console.error("Folder not found.");
});
// Output
// ["machines", "appliances"]
Root directory.
Relative directory.
Array with contents; Rejects with errors from fs.readdir.
Access stdout
Extracts relative path from rootDir to target.
Usage
// Convert path and output the result
console.log(Loader.toRelative("c:\machines\refrigerators", "c:\machines\appliances"));
// Output
// ..\appliances
Source folder.
File/folder name|names.
Relative path|paths.
Converts YAML string to a JS object.
Usage
// Ouput conversion of YAML to JSON
console.log(Loader.yamlToObject("Wine: Red"));
// Output
// {"Wine": "Red"}
YAML string.
Javascript object.
Generated using TypeDoc
Provides wide range of functionality for file loading and event exchange. Throws standard error if failed to perform basic initializations, or system failure that cannot be reported otherwise has occured.
Error
loader_failed
- Loader did not construct the mandatory properties // TODO: @event module:system.private#events#systemLoad