Skip to content

Instantly share code, notes, and snippets.

@pchw
Created March 12, 2013 06:19
Show Gist options
  • Save pchw/5140743 to your computer and use it in GitHub Desktop.
Save pchw/5140743 to your computer and use it in GitHub Desktop.
var s = require('./index').service;
var submod = require('./index').submod;
s.hoge();
submod.hoge();
module.exports.service = require('./mod.js');
module.exports.submod = require('./submod');
var hoge = null;
module.exports = {
'hoge':function(){
if (!hoge) {
console.log('construct!');
hoge = "hoge"
}
console.log(hoge);
}
};
node app.js
construct!
hoge
hoge
var m = require('./mod');
module.exports = {
hoge: function(){m.hoge();}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment