houston...

This commit is contained in:
kolaflash
2026-01-06 14:12:21 +01:00
parent 5dd5f13c43
commit c52b62cdaf
9 changed files with 95 additions and 122 deletions
+4 -4
View File
@@ -1,7 +1,7 @@
export type Cache<T> = Map<string, T>;
export type AsyncCache<T> = Map<string, Promise<T>>;
export function withCache<T, U extends (...args: unknown[]) => T>(
export function withCache<T, U extends (...args: any[]) => T>(
callback: U,
key: string,
cache: Cache<T>,
@@ -18,7 +18,7 @@ export function withCache<T, U extends (...args: unknown[]) => T>(
};
}
export function withAsyncCache<T, U extends (...args: unknown[]) => Promise<T>>(
export function withAsyncCache<T, U extends (...args: any[]) => Promise<T>>(
callback: U,
key: string,
cache: AsyncCache<T>,
@@ -36,7 +36,7 @@ export function withAsyncCache<T, U extends (...args: unknown[]) => Promise<T>>(
}
export function useWithCache<T>(
callback: (...args: unknown[]) => T,
callback: (...args: any[]) => T,
): [(uri: string) => T, Cache<T>] {
const cache: Cache<T> = new Map();
@@ -44,7 +44,7 @@ export function useWithCache<T>(
}
export function useWithAsyncCache<T>(
callback: (...args: unknown[]) => Promise<T>,
callback: (...args: any[]) => Promise<T>,
): [(uri: string) => Promise<T>, AsyncCache<T>] {
const cache: AsyncCache<T> = new Map();