Skip to content

Instantly share code, notes, and snippets.

@elenaparaschiv
Last active July 1, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elenaparaschiv/02227d74e067a11461b38ef7f6c1eee9 to your computer and use it in GitHub Desktop.
Save elenaparaschiv/02227d74e067a11461b38ef7f6c1eee9 to your computer and use it in GitHub Desktop.
(function(){
var libraryStorage = {};
var dependenciesGathered = [];
function librarySystem(libraryName, dependencies, callback){
if(arguments.length > 1){
dependencies.forEach(function(dep){
dependenciesGathered.push(libraryStorage[dep]);
});
libraryStorage[libraryName] = callback.apply(this, dependenciesGathered);
}else{
return libraryStorage[libraryName];
}
}
window.librarySystem = librarySystem;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment