Home
Sign Up
Sign In
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member
Sign In
Advertisement
V2EX
›
Node.js
nodejs中能够判断这个模块是程序入口么。就像python里面 if __name__ == 'main' : 这样的。
mercurylanded
·
Dec 19, 2012
· 4401 views
This topic created in 4889 days ago, the information mentioned may be changed or developed.
__
Python
Nodejs
2 replies
•
1970-01-01 08:00:00 +08:00
1
qiao
Dec 19, 2012
1
http://stackoverflow.com/questions/8864365/can-i-know-in-node-js-if-my-script-is-being-run-directly-or-being-loaded-by-an/8864401#8864401
2
jackyz
Dec 19, 2012
if(!module.parent){
console.log('我是程序入口');
}
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
2789 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 31ms ·
UTC 01:40
·
PVG 09:40
·
LAX 18:40
·
JFK 21:40
♥ Do have faith in what you're doing.
❯