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

Function makeHook

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

Source from the content-addressed store, hash-verified

10const { AsyncParallelHook } = tapable;
11
12function makeHook(numTaps, kind) {
13 const hook = new AsyncParallelHook(["a"]);
14 for (let i = 0; i < numTaps; i++) {
15 const name = `plugin-${i}`;
16 if (kind === "sync") {
17 hook.tap(name, () => {});
18 } else if (kind === "async") {
19 hook.tapAsync(name, (_a, cb) => cb());
20 } else if (kind === "promise") {
21 hook.tapPromise(name, () => Promise.resolve());
22 }
23 }
24 hook.callAsync(1, () => {});
25 return hook;
26}
27
28const INNER_ITERATIONS = 200;
29

Callers 1

registerFunction · 0.70

Calls 3

tapMethod · 0.45
tapAsyncMethod · 0.45
tapPromiseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…