mirror of
https://github.com/SukkaW/Surge.git
synced 2026-01-29 01:51:52 +08:00
Minor changes here and there
This commit is contained in:
@@ -1,9 +1,5 @@
|
||||
export const createMemoizedPromise = <T>(fn: () => Promise<T>, preload = true): () => Promise<T> => {
|
||||
let promise: Promise<T> | null = null;
|
||||
|
||||
if (preload) {
|
||||
promise = fn();
|
||||
}
|
||||
let promise: Promise<T> | null = preload ? fn() : null;
|
||||
|
||||
return () => {
|
||||
promise ??= fn();
|
||||
|
||||
Reference in New Issue
Block a user