| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 3061cb5 commit 42fc754
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -151,7 +151,11 @@ function startup() { | |||
| 151 | 151 | } | |
| 152 | 152 | ||
| 153 | 153 | if (config.hasInspector) { | |
| 154 | - NativeModule.require('internal/inspector_async_hook').setup(); | ||
| 154 | + const { | ||
| 155 | + enable, | ||
| 156 | + disable | ||
| 157 | + } = NativeModule.require('internal/inspector_async_hook'); | ||
| 158 | + internalBinding('inspector').registerAsyncHook(enable, disable); | ||
| 155 | 159 | } | |
| 156 | 160 | ||
| 157 | 161 | // If the process is spawned with env NODE_CHANNEL_FD, it's probably | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,16 +1,10 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | - const inspector = internalBinding('inspector'); | ||
| 4 | - | ||
| 5 | - if (!inspector || !inspector.asyncTaskScheduled) { | ||
| 6 | - exports.setup = function() {}; | ||
| 7 | - return; | ||
| 8 | - } | ||
| 9 | - | ||
| 10 | 3 | let hook; | |
| 11 | 4 | let config; | |
| 12 | 5 | ||
| 13 | 6 | function lazyHookCreation() { | |
| 7 | + const inspector = internalBinding('inspector'); | ||
| 14 | 8 | const { createHook } = require('async_hooks'); | |
| 15 | 9 | config = internalBinding('config'); | |
| 16 | 10 | ||
@@ -72,6 +66,7 @@ function disable() { | |||
| 72 | 66 | hook.disable(); | |
| 73 | 67 | } | |
| 74 | 68 | ||
| 75 | - exports.setup = function() { | ||
| 76 | - inspector.registerAsyncHook(enable, disable); | ||
| 69 | + module.exports = { | ||
| 70 | + enable, | ||
| 71 | + disable | ||
| 77 | 72 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments