MCPcopy Index your code
hub / github.com/nodejs/node / disable

Method disable

lib/async_hooks.js:143–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

141 }
142
143 disable() {
144 const { 0: hooks_array, 1: hook_fields } = getHookArrays();
145
146 const index = ArrayPrototypeIndexOf(hooks_array, this);
147 if (index === -1)
148 return this;
149
150 const prev_kTotals = hook_fields[kTotals];
151
152 hook_fields[kTotals] = hook_fields[kInit] -= +!!this[init_symbol];
153 hook_fields[kTotals] += hook_fields[kBefore] -= +!!this[before_symbol];
154 hook_fields[kTotals] += hook_fields[kAfter] -= +!!this[after_symbol];
155 hook_fields[kTotals] += hook_fields[kDestroy] -= +!!this[destroy_symbol];
156 hook_fields[kTotals] +=
157 hook_fields[kPromiseResolve] -= +!!this[promise_resolve_symbol];
158 ArrayPrototypeSplice(hooks_array, index, 1);
159
160 if (prev_kTotals > 0 && hook_fields[kTotals] === 0) {
161 disableHooks();
162 }
163
164 return this;
165 }
166}
167
168

Callers

nothing calls this directly

Calls 2

getHookArraysFunction · 0.85
disableHooksFunction · 0.85

Tested by

no test coverage detected