Details
This method will load in scripts via ajax, cache them, wrap them, then execute them.
Arguments
system.loader(string path, [function callBack]);
path: Path of the script to be executed.
callBack (Optional): Function to be called when method is finished.
this keyword: Returns true if loaded successful without errors. False if not.
Injected 'loader' object.
system.loader() will inject an object into the loaded script.
- loader.path: Will equal the given path to the loaded script.
- loader.folder: Will equal the folder the loaded script is in.
Example
/* /folder/script.js Contents
console.log('I have been loaded, and cached. My path is: '+loader.path)
*/
var path = '/folder/script.js';
system.loader(path, function() {
if(this) {
console.log('I have loaded successfully.');
}
}); /
/* Console Log
I have been loaded, and cached. My path is: /folder/script.js
I have loaded successfully.
*/