Created
February 25, 2010 17:41
-
-
Save kentaromiura/314797 to your computer and use it in GitHub Desktop.
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
var require =(function(){ | |
var imports = new Hash(); | |
var path = "libs" | |
return function(lib){ | |
if(!imports.has(lib)){ | |
var req = new Request({ | |
url:[path,lib].join('/') + ".js", | |
async:false | |
}); | |
req.send(''); | |
imports.set(lib,eval(['(function(){var exports={},module={name:"',lib,'"};',req.xhr.responseText,';return exports;})()'].join(''))); | |
} | |
return imports[lib]; | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment