Members
get
isset
alert (RSLIB.requireIsset (typeof unknown_variable));
nameLIB
onComplete
Event employee for pass an external callback function to be executed upon completion of the loaded library.
This can be useful if, for example, you want to immediately use a resource (variable, object, method, ...) defined in the library.
This should be done within the ' callback ' function as incorporating the various scripts in HTML-Head of a synchronous load page ' modifies the flow execution javascript ' occurs due to the DOM modification, it can (depending on the browser) run the last library scripts.
options
An embedded options object within the label ' script ' is expected to pass to this loader with the terms:
- nameLIB: name of the library to load
- pathToLIB: path (relative or absolute) to the library directory with respect to HTML caller.
- scripts: An array with the path relative to each script file you want to load. The last element of the array will not be loaded, which is only indicates the main on which to launch the ' onComplete (..) ' method.
pathToLIB
rsLIB
ASYNC REQUIRE LIBRARY :: INSERT THE LINKED-SCRIPTS PARAMETERS IN THE HEAD SYNCHRONOUSLY, BUT WITHOUT AJAX.
It is the loader object (global ' rsLIB ' variable ) with an anonymous loader function and as members:
- options: the complete object detected as embedded options.
- nameLIB: name of library to load.
- pathToLIB: the path to the library, based on the situation of HTML caller.
- scripts: the array of scripts to load the library.
- get: get properties of embedded object.
- isset: utility method to check whether a variable is undefined.
- onComplete (..): The method that can be passed a ' callback ' function as the only parameter.
Import dynamically (albeit unorthodox) all the library 'assets' , it inserting (if not previously existed) after the label linked with this file (rsLIB.js) in the 'head'. It work synchronously, that is, they must wait until they are loaded and interpreted to use them immediately.
If so required (immediately) because some variable or function defined in scripts is used, should work within the event onComplete(..) through a function callback, for example:
rsLIB.onComplete( function(){
//code to execute when the scripts are loaded.
} );
scripts
WARNING: THE LAST ELEMENT NOT BE CHARGED, WHICH IS ONLY INDICATES THE MAIN ON WHICH TO LAUNCH THE ' onComplete(..) ' EVENT.