UNPKG
cpupro
Version:
latest (0.7.0)
0.7.0
0.6.0
0.5.1
0.5.0
0.4.0
0.3.0
0.2.1
0.2.0
0.1.1
0.1.0
Rethinking of CPU profile (collected in Node.js or Chromium browsers) analysis
cpupro
/
lib
/
if-loaded-with-require.js
10 lines
(8 loc)
•
293 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
/* eslint-env node */
const
{ profile } =
require
(
'./profiler'
);
module
.
exports
=
function
ifLoadedWithRequire
(
module
, callback
) {
// if loaded with --require, start profiling
if
(
module
.
parent
&&
module
.
parent
.
id
===
'internal/preload'
) {
profile
().
onEnd
(callback); } };