Created
March 28, 2018 00:39
-
-
Save wyrfel/3852738bb8cf02063bd3354f0080054f to your computer and use it in GitHub Desktop.
fn.load-script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function () { | |
return function (url, callback) { | |
var doc = document, | |
el = doc.createElement('script'); | |
el.src = url; | |
el.async = 1; | |
if (callback) { | |
el.addEventListener('load', callback); | |
} | |
doc.getElementsByTagName('head')[0].appendChild(el); | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment