MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / makeLazyPromise

Function makeLazyPromise

packages/@stdlib/misc/src/promises.ts:85–99  ·  view source on GitHub ↗
(
  asyncFunc: () => PromiseLike<any>,
)

Source from the content-addressed store, hash-verified

83}
84
85export function makeLazyPromise(
86 asyncFunc: () => PromiseLike<any>,
87): PromiseLike<any> {
88 let promise: PromiseLike<any> | undefined;
89
90 return {
91 then: (onFulfilled, onRejected) => {
92 if (promise == null) {
93 promise = asyncFunc();
94 }
95
96 return promise.then(onFulfilled, onRejected);
97 },
98 };
99}

Callers

nothing calls this directly

Calls 1

thenMethod · 0.80

Tested by

no test coverage detected