MCPcopy
hub / github.com/excalidraw/excalidraw / createJobFactory

Function createJobFactory

packages/excalidraw/queue.test.ts:7–25  ·  view source on GitHub ↗
(
      // for purpose of this test, Error object will become a rejection value
      resolutionOrRejectionValue: T,
      ms = 1,
    )

Source from the content-addressed store, hash-verified

5
6 const createJobFactory =
7 <T>(
8 // for purpose of this test, Error object will become a rejection value
9 resolutionOrRejectionValue: T,
10 ms = 1,
11 ) =>
12 () => {
13 return new Promise<T>((resolve, reject) => {
14 setTimeout(() => {
15 if (resolutionOrRejectionValue instanceof Error) {
16 reject(resolutionOrRejectionValue);
17 } else {
18 resolve(resolutionOrRejectionValue);
19 }
20 }, ms);
21 }).then((x) => {
22 calls.push(x);
23 return x;
24 });
25 };
26
27 beforeEach(() => {
28 calls.length = 0;

Callers 1

queue.test.tsFile · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…