MCPcopy
hub / github.com/GoogleChrome/workbox / eventDoneWaiting

Function eventDoneWaiting

infra/testing/helpers/extendable-event-utils.mjs:12–23  ·  view source on GitHub ↗
(event, {catchErrors = true} = {})

Source from the content-addressed store, hash-verified

10const eventResponses = new WeakMap();
11
12export const eventDoneWaiting = async (event, {catchErrors = true} = {}) => {
13 const promises = extendLifetimePromises.get(event);
14 let promise;
15
16 while ((promise = promises.shift())) {
17 // Ignore errors by default;
18 if (catchErrors) {
19 promise = promise.catch((e) => e);
20 }
21 await promise;
22 }
23};
24
25export const spyOnEvent = (event) => {
26 const promises = [];

Calls 1

getMethod · 0.80

Tested by

no test coverage detected