requireasync
v0.0.19
Published
async require for the browser, also works in node
Downloads
38
Readme
requireasync
usage
if(!window)var window=eval(require('requireasync').install);else var node=false,browser=true;
REQUIRE(
["fs", "path.resolve"],
function (err, fs, resolve) {
fs.readFile(resolve(".","readme,md"),function(err,data){
console.log(err,data);
})
}
)
Shorthand: $R$ can be substituted for REQUIRE
Try this for an instant load and run one liner:
console.log($R$({path:"resolve"})(".","myfile.js"));
See the html folder for a working demo.
change to that folder and type
$ npm install .
$ node demo.js
To load the demo server, and it will give you a local browser url along the lines of
visit http://localhost:8080/index.html to demo the browser files