how can i t change this code to run the function when the js library finish loading? uisng vanilla javascript
because i'm using a timer that didn't worked for slow internet connection
imported = document.createElement('script');
imported.src = 'https://pastebin.com/raw/dRap1YD8';
document.head.appendChild(imported);
var delayInMilliseconds = 1000;
setTimeout(function() {
.
.
.
}, delayInMilliseconds);
Note that pastebin is just for test