diff options
author | Jan Krems <jan.krems@gmail.com> | 2014-06-21 17:09:04 -0700 |
---|---|---|
committer | Fedor Indutny <fedor@indutny.com> | 2014-06-24 20:21:25 +0400 |
commit | ad5e8ec3e2845d8d048ac8160f6af0194bc2b7e9 (patch) | |
tree | b799e8a6f2fe617dbea65840c8322c397e0d6e42 /doc | |
parent | fcbffa71d030e48a10e29e35d973e40d0418fda0 (diff) | |
download | android-node-v8-ad5e8ec3e2845d8d048ac8160f6af0194bc2b7e9.tar.gz android-node-v8-ad5e8ec3e2845d8d048ac8160f6af0194bc2b7e9.tar.bz2 android-node-v8-ad5e8ec3e2845d8d048ac8160f6af0194bc2b7e9.zip |
doc: process: Document process.mainModule
Instrumentation code might need to find out the entry point of the
process in a global context.
Documenting the existing process.mainModule to officially support this.
Fixes #7808
Signed-off-by: Fedor Indutny <fedor@indutny.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/process.markdown | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/api/process.markdown b/doc/api/process.markdown index eac1d4e1e4..8c914f3cef 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -716,4 +716,16 @@ a diff reading, useful for benchmarks and measuring intervals: // benchmark took 1000000527 nanoseconds }, 1000); + +## process.mainModule + +Alternate way to retrieve +[`require.main`](modules.html#modules_accessing_the_main_module). +The difference is that if the main module changes at runtime, `require.main` +might still refer to the original main module in modules that were required +before the change occurred. Generally it's safe to assume that the two refer +to the same module. + +As with `require.main`, it will be `undefined` if there was no entry script. + [EventEmitter]: events.html#events_class_events_eventemitter |