Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function loadScript(src, async) {
- return new Promise(function (resolve, reject) {
- var s;
- s = document.createElement('script');
- s.src = src;
- s.async = async;
- s.onload = resolve;
- s.onerror = reject;
- document.head.appendChild(s);
- });
- }
- loadScript('source', false).then(success => {
- //Run your code here which depends on that file
- })
Add Comment
Please, Sign In to add comment