1
guchengf 2014 年 8 月 7 日 var main = function(){
// main code } if (require.main === module) { main(); } |
2
SoloCompany 2014 年 8 月 7 日
@guchengf 我的习惯是用 process.mainModule, 然后刚才去查了下文档, 貌似两个用法都不在文档里面
|
3
magicdawn 2014 年 8 月 8 日
module有parent和childrens属性
if(module.parent) { //被require的时候 } |
4
ibudao 2014 年 8 月 8 日
|
5
xieren58 2014 年 8 月 23 日
if(!module.parent) xxxxxxxxx
|