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

Function createHook

lib/internal/promise_hooks.js:105–118  ·  view source on GitHub ↗
({ init, before, after, settled } = kEmptyObject)

Source from the content-addressed store, hash-verified

103const onSettled = makeUseHook('settled');
104
105function createHook({ init, before, after, settled } = kEmptyObject) {
106 const hooks = [];
107
108 if (init) ArrayPrototypePush(hooks, onInit(init));
109 if (before) ArrayPrototypePush(hooks, onBefore(before));
110 if (after) ArrayPrototypePush(hooks, onAfter(after));
111 if (settled) ArrayPrototypePush(hooks, onSettled(settled));
112
113 return () => {
114 for (const stop of hooks) {
115 stop();
116 }
117 };
118}
119
120module.exports = {
121 createHook,

Callers 3

lazyHookCreationFunction · 0.70
setupProcessStateFunction · 0.50
async_hooks.jsFile · 0.50

Calls 2

onSettledFunction · 0.85
stopFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…