File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,12 @@ const before_symbol = Symbol('before');
4949const after_symbol = Symbol ( 'after' ) ;
5050const destroy_symbol = Symbol ( 'destroy' ) ;
5151
52- let setupHooksCalled = false ;
52+ // Setup the callbacks that node::AsyncWrap will call when there are hooks to
53+ // process. They use the same functions as the JS embedder API.
54+ async_wrap . setupHooks ( { init,
55+ before : emitBeforeN ,
56+ after : emitAfterN ,
57+ destroy : emitDestroyN } ) ;
5358
5459// Used to fatally abort the process if a callback throws.
5560function fatalError ( e ) {
@@ -98,16 +103,6 @@ class AsyncHook {
98103 if ( hooks_array . includes ( this ) )
99104 return this ;
100105
101- if ( ! setupHooksCalled ) {
102- setupHooksCalled = true ;
103- // Setup the callbacks that node::AsyncWrap will call when there are
104- // hooks to process. They use the same functions as the JS embedder API.
105- async_wrap . setupHooks ( { init,
106- before : emitBeforeN ,
107- after : emitAfterN ,
108- destroy : emitDestroyN } ) ;
109- }
110-
111106 // createHook() has already enforced that the callbacks are all functions,
112107 // so here simply increment the count of whether each callbacks exists or
113108 // not.
You can’t perform that action at this time.
0 commit comments