Skip to content

Commit

Permalink
process: add .initialEventLoop
Browse files Browse the repository at this point in the history
PR-URL: #28941
  • Loading branch information
ChALkeR committed Feb 18, 2020
1 parent 8ba7a2f commit 0b99cb1
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ const rawMethods = internalBinding('process_methods');
};
}

{
let perf_hooks;
let initialEventLoop = true;
ObjectDefineProperty(process, 'initialEventLoop', {
enumerable: true,
configurable: false,
get() {
if (initialEventLoop) {
if (!perf_hooks) perf_hooks = require('perf_hooks');
initialEventLoop = perf_hooks.performance.nodeTiming.loopStart < 0;
}
return initialEventLoop;
}
});
}

const credentials = internalBinding('credentials');
if (credentials.implementsPosixCredentials) {
process.getuid = credentials.getuid;
Expand Down

0 comments on commit 0b99cb1

Please sign in to comment.