mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
fix(package): use generics to define return type
This commit is contained in:
4
package/shared/resource/cache/index.ts
vendored
4
package/shared/resource/cache/index.ts
vendored
@@ -4,7 +4,7 @@ export const cache: Record<string, any> = new Proxy(
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
get(target, key: string) {
|
get(target, key: string) {
|
||||||
let result = key ? target[key] : target;
|
const result = key ? target[key] : target;
|
||||||
if (result) return result;
|
if (result) return result;
|
||||||
|
|
||||||
AddEventHandler(`ox_lib:cache:${key}`, (value: any) => {
|
AddEventHandler(`ox_lib:cache:${key}`, (value: any) => {
|
||||||
@@ -17,6 +17,6 @@ export const cache: Record<string, any> = new Proxy(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
export const onCache = (key: string, cb: (value: any) => void) => {
|
export const onCache = <T = any>(key: string, cb: (value: T) => void) => {
|
||||||
AddEventHandler(`ox_lib:cache:${key}`, cb);
|
AddEventHandler(`ox_lib:cache:${key}`, cb);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user