async-scripts-loader
v1.0.2
Published
async-scripts-loader package loads bunch of js files in async way and handles when all the given files are loaded. It returns Promise. Handled "onload" and "onerror" states.
Downloads
526
Readme
async-scripts-loader
async-scripts-loader
package loads bunch of js files in async way and handles when all the given files are loaded with onload
and onerror
states for each given script.
Package is bundled as UMD and compatible with browser and npm.
It returns a Promise
from Promise.all().
async-scripts-loader
is extra tiny (less then 1.5 KB) and does not have external dependencies!
Examples
Browser
<script src="https://unpkg.com/async-scripts-loader"></script>
<script>
loadScriptAsync(['https://code.jquery.com/jquery-3.4.1.min.js', 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js']).then(() => {
console.log("Scripts are loaded");
});
</script>
NPM
const loadScriptAsync = require("async-scripts-loader");
Source Code
Contribution Notes
Clone project on github
Install libraries
npm i
Build & Test
npm test