This file contains 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(){ | |
var libraryStorage = {}; | |
function librarySystem(libraryName, dependencies,callback){ | |
if (arguments.length===1){ | |
return libraryStorage[libraryName]; | |
} else if (arguments.length>1){ | |
if (dependencies.length===0){ | |
libraryStorage[libraryName]=callback(); | |
} else { | |
var dependentLibraries = dependencies.map(function(dependency){ |
This file contains 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 runWithDebugger(callback, optionalArgs){ | |
//check optionalArgs is undefined | |
if (optionalArgs===undefined){ | |
debugger; | |
callback(); | |
} | |
else if ( Object.getPrototypeOf(optionalArgs)===Array.prototype ){ | |
debugger; | |
callback.apply(null, optionalArgs); | |
} |