Created
December 7, 2010 03:29
-
-
Save 525c1e21-bd67-4735-ac99-b4b0e5262290/731411 to your computer and use it in GitHub Desktop.
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
window.modules = {} | |
modules.test = (require, module) -> | |
module.exports = -> | |
console.log 'game created' | |
window.require = (-> | |
library = {} | |
require = (handle) -> | |
if library.hasOwnProperty handle | |
return library[name] | |
module = {exports: {}} | |
library[handle] = module | |
throw "#{handle} not found" if !window.modules[handle]? | |
window.modules[handle](require, module) | |
return module.exports | |
return require | |
)() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment