MCPcopy
hub / github.com/webpack/tapable / makeHook

Function makeHook

benchmark/cases/async-series-bail-hook/index.bench.mjs:13–26  ·  view source on GitHub ↗
(numTaps, kind, bailAt)

Source from the content-addressed store, hash-verified

11const { AsyncSeriesBailHook } = tapable;
12
13function makeHook(numTaps, kind, bailAt) {
14 const hook = new AsyncSeriesBailHook(["a"]);
15 for (let i = 0; i < numTaps; i++) {
16 const idx = i;
17 const name = `plugin-${idx}`;
18 if (kind === "sync") {
19 hook.tap(name, (v) => (idx === bailAt ? v : undefined));
20 } else {
21 hook.tapAsync(name, (v, cb) => cb(null, idx === bailAt ? v : undefined));
22 }
23 }
24 hook.callAsync(1, () => {});
25 return hook;
26}
27
28const INNER_ITERATIONS = 200;
29

Callers 1

registerFunction · 0.70

Calls 2

tapMethod · 0.45
tapAsyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…