projectstarboy_ox_lib
Version:
JS/TS wrapper for ox_lib exports
22 lines • 692 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.onCache = exports.cache = void 0;
exports.cache = new Proxy({
resource: GetCurrentResourceName(),
}, {
get(target, key) {
const result = key ? target[key] : target;
if (result !== undefined)
return result;
AddEventHandler(`ox_lib:cache:${key}`, (value) => {
target[key] = value;
});
target[key] = exports.ox_lib.cache(key) || false;
return target[key];
},
});
const onCache = (key, cb) => {
AddEventHandler(`ox_lib:cache:${key}`, cb);
};
exports.onCache = onCache;
//# sourceMappingURL=index.js.map