Dynamic script loading.
This is fork of eldargab/load-script
. That fork has not bee touched in a year
and I needed some features not available there. If these changes get merged back into
upstream, then I will unpublish this module. Here is where jsdevel-load-script
differs:
- The module now accepts 3 params
url, [opts,] [cb]
- Opts can take
attrs
ortext
. - The script node is passes as the second argument to the callback.
via component
$ component install jsdevel/jsdevel-load-script
via npm
$ npm install jsdevel-load-script
var load = require('jsdevel-load-script')
load('foo.js', function (err) {
if (err) {
// print useful message
}
else {
// use script
// note that in IE8 and below loading error wouldn't be reported
}
})
MIT