A simple function for asynchronously loading JavaScript files
npm install fg-loadjsloadJS
======


A simple function for asynchronously loading JavaScript files
- [c]2014 @scottjehl, Filament Group, Inc.
- Based on Surefire Dom Element Insertion by Paul Irish
- Licensed MIT
Place the loadJS function inline in the head of your page (it can also be included in an external JavaScript file if preferable).
Then call it by passing it a JavaScript URL:
`` html`
...
...
You can execute code after the Script has loaded via a callback:
` html`
...
...
You can ensure ordered execution of multiple asynchronous by passing true as the second or third parameter. Only supported in browsers that support the async attribute (No IE8/IE9 support).:
`js`
loadJS( "path/to/library.js", true );
loadJS( "path/to/plugins.js", true );
loadJS( "path/to/last.js", function() {
//all scripts loaded
}, true );
...
``
#### Contributions and bug fixes
Both are very much appreciated - especially bug fixes. As for contributions, the goals of this project are to keep things very simple and utilitarian, so if we don't accept a feature addition, it's not necessarily because it's a bad idea. It just may not meet the goals of the project. Thanks!