Package Exports
- load-jscript
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (load-jscript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
load-jscript
Promise based script loader for the browser using script tags.
usage
install
$ npm install load-jscript
options
type
: defaults totext/javascript
.async
: defaults totrue
.charset
: defaults toutf-8
.id
: no default value.
examples
// import module
import loadJScript from 'node_modules/load-jscript';
loadJScript.load(url|[urls], options)
.then(callback)
.catch(error)
// single script
loadJScript.load('//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js').then(() => {
console.log(_.VERSION);
});
//multiple script
loadJScript.load([
'//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.8.3/underscore-min.js',
'//cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js']
).then(() => {
console.log(_.VERSION);
console.log(jQuery.fn.jquery);
}
);