mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36:02 +01:00
fix(package/cache): check if cached value is defined
This commit is contained in:
4
package/shared/resource/cache/index.ts
vendored
4
package/shared/resource/cache/index.ts
vendored
@@ -5,13 +5,13 @@ export const cache: Record<string, any> = new Proxy(
|
|||||||
{
|
{
|
||||||
get(target, key: string) {
|
get(target, key: string) {
|
||||||
const result = key ? target[key] : target;
|
const result = key ? target[key] : target;
|
||||||
if (result) return result;
|
if (result !== undefined) return result;
|
||||||
|
|
||||||
AddEventHandler(`ox_lib:cache:${key}`, (value: any) => {
|
AddEventHandler(`ox_lib:cache:${key}`, (value: any) => {
|
||||||
target[key] = value;
|
target[key] = value;
|
||||||
});
|
});
|
||||||
|
|
||||||
target[key] = exports.ox_lib.cache(key);
|
target[key] = exports.ox_lib.cache(key) || false;
|
||||||
return target[key];
|
return target[key];
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user