mirror of
https://github.com/SukkaW/Surge.git
synced 2025-12-12 01:00:34 +08:00
8 lines
194 B
TypeScript
8 lines
194 B
TypeScript
export const createMemoizedPromise = <T>(fn: () => Promise<T>): () => Promise<T> => {
|
|
let promise: Promise<T> | null = null;
|
|
return () => {
|
|
promise ||= fn();
|
|
return promise;
|
|
};
|
|
};
|