Guest User

Untitled

a guest
Apr 24th, 2018
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. function loadScript(src, async) {
  2. return new Promise(function (resolve, reject) {
  3. var s;
  4. s = document.createElement('script');
  5. s.src = src;
  6. s.async = async;
  7. s.onload = resolve;
  8. s.onerror = reject;
  9. document.head.appendChild(s);
  10. });
  11. }
  12.  
  13.  
  14. loadScript('source', false).then(success => {
  15. //Run your code here which depends on that file
  16. })
Add Comment
Please, Sign In to add comment