Last active
May 18, 2016 13:49
-
-
Save ratopi/6ae650b8b2795cd4c2ffd1187c8d08d6 to your computer and use it in GitHub Desktop.
Simple include for JavaScript
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
var include = (function () | |
{ | |
var knownPaths = {}; | |
return ( | |
function ( path ) | |
{ | |
if ( knownPaths[ path ] ) return; | |
knownPaths[ path ] = true; | |
var tag = document.createElement( "script" ); | |
tag.type = "text/javascript"; | |
tag.src = path; | |
document.getElementsByTagName( "head" )[ 0 ].appendChild( tag ); | |
} | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment