Created
May 28, 2012 03:19
-
-
Save hitsujiwool/2817024 to your computer and use it in GitHub Desktop.
module autoload in Node.js
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 foo = {}; | |
foo.__defineGetter__('bar', function() { | |
return require('./bar'); | |
}); | |
foo.bar(); |
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
module.exports = function() { | |
console.log('module bar called'); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment