diff --git a/shared/manager/buildRegFn.ts b/shared/manager/buildRegFn.ts index cacc929a..16cd03da 100644 --- a/shared/manager/buildRegFn.ts +++ b/shared/manager/buildRegFn.ts @@ -53,7 +53,7 @@ export function buildRegFnWithEvent any>( /** * 缓存版本的buildRegFn */ -export function buildCachedRegFn any>( +export function buildCachedRegFn Promise>( name: string, defaultFunc?: F ) { @@ -62,12 +62,12 @@ export function buildCachedRegFn any>( let _result: any = null; // 缓存的返回值 let _lastArgs: any; - const cachedGet = (...args: any) => { + const cachedGet = async (...args: any) => { if (_result !== null && _isEqual(args, _lastArgs)) { // 当有缓存的返回值且两次参数一致 return _result; } else { - const result = get(...args); + const result = await get(...args); _result = result ?? null; _lastArgs = args; return result;