Dynamic Loading JavaScript
Using npm:
$ npm install loading-script
Using jsDelivr CDN:
<script src="https://cdn.jsdelivr.net/npm/loading-script/dist/loading-script.js"></script>
Using unpkg CDN:
<script src="https://unpkg.com/loading-script/dist/loading-script.js"></script>
const {getScript} = require("loading-script");
getScript('test.js', function(){
console.log('onload')
});
<script src="https://cdn.jsdelivr.net/npm/loading-script/dist/loading-script.js"></script>
getScript('test.js', function(){
console.log('onload')
});