Skip to content

Instantly share code, notes, and snippets.

@RichardDillman
Last active October 26, 2018 15:41
Show Gist options
  • Save RichardDillman/af53bf3c551cafc4adeefa1c3b19b424 to your computer and use it in GitHub Desktop.
Save RichardDillman/af53bf3c551cafc4adeefa1c3b19b424 to your computer and use it in GitHub Desktop.
Append multiple async scripts to the page.
(function(d, u) {
const i = u.length
let s;
while (i--) {
s = d.createElement('script');
s.async = true;
s.src = u[i];
d.head.appendChild(s);
}
}(document, [
'script1.js',
'script2.js',
'script3.js',
'script4.js'
]));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment