
1 guchengf 2014-08-07 14:57:31 +08:00 var main = function(){ // main code } if (require.main === module) { main(); } |
2 SoloCompany 2014-08-07 22:28:23 +08:00 @guchengf 我的习惯是用 process.mainModule, 然后刚才去查了下文档, 貌似两个用法都不在文档里面 |
3 magicdawn 2014-08-08 06:29:14 +08:00 module有parent和childrens属性 if(module.parent) { //被require的时候 } |
4 ibudao 2014-08-08 11:17:00 +08:00 |
5 if(!module.parent) xxxxxxxxx |