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

Function makeHook

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

Source from the content-addressed store, hash-verified

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

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…