decord/source/stores/MobileCacheSnapshotStore.tsx

79 lines
2.6 KiB
TypeScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 1220
// Function ID: 1221
// Name: clearAll
// Dependencies: [589, 709, 38, 595, 2]
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
// Module 1220 (clearAll)
2026-08-24 06:08:38 +00:00
import _modDef38 from "module_38" /* 38 */;
import initializeDefault from "initialize" /* 589 */;
import Storage2 from "Storage" /* 595 */;
import dispatcherDefault from "dispatcher" /* 709 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-29 08:29:29 +00:00
let MobileCacheSnapshotStore;
2026-08-24 06:08:38 +00:00
const Store = initializeDefault.Store;
2026-07-29 08:29:29 +00:00
class MobileCacheSnapshotStore extends Store {
constructor(arg0, arg1) {
2026-08-24 06:08:38 +00:00
closure_0 = undefined;
2026-07-29 08:29:29 +00:00
tmp3 = require("dispatcher");
obj = {};
merged = Object.assign(global);
obj.CLEAR_CACHES = function CLEAR_CACHES() {
obj.clear();
return false;
};
obj.WRITE_CACHES = function WRITE_CACHES() {
obj.save();
return false;
};
tmp2 = new tmp2(tmp3, obj, arg1, new.target, tmp2, tmp3, obj, new.target, undefined, tmp, global, closure_1);
// ThrowIfThisInitialized (0x7c)
2026-08-24 06:08:38 +00:00
closure_0 = tmp2;
2026-07-29 08:29:29 +00:00
tmp5 = require("module_38");
tmp5Result = tmp5(null != tmp2.getClass().displayName, "Snapshot stores need a display name");
tmp7 = require("module_38")(!("CLEAR_CACHES" in global), "MobileCacheSnapshotStores cannot use the 'CLEAR_CACHES' action");
tmp8 = require("module_38")(!("WRITE_CACHES" in global), "MobileCacheSnapshotStores cannot use the 'WRITE_CACHES' action");
allStores = MobileCacheSnapshotStore.allStores;
arr = allStores.push(tmp2);
return tmp2;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = MobileCacheSnapshotStore.prototype;
MobileCacheSnapshotStore["clearAll"] = function clearAll() {
const allStores = MobileCacheSnapshotStore.allStores;
const item = allStores.forEach((clear) => clear.clear());
};
Object.defineProperty(prototype, "persistKey", {
get: function persistKey() {
return "" + this.getClass().displayName + "-snapshot";
},
set: undefined
});
prototype["clear"] = function clear() {
2026-08-24 06:08:38 +00:00
const Storage = Storage2.Storage;
2026-07-29 08:29:29 +00:00
Storage.remove(this.persistKey);
};
prototype["save"] = function save() {
2026-08-24 06:08:38 +00:00
const Storage = Storage2.Storage;
2026-07-29 08:29:29 +00:00
const result = Storage.set(this.persistKey, this.takeSnapshot());
};
prototype["readSnapshot"] = function readSnapshot(LATEST_SNAPSHOT_VERSION) {
2026-08-24 06:08:38 +00:00
const Storage = Storage2.Storage;
2026-07-29 08:29:29 +00:00
const value = Storage.get(this.persistKey);
let data = null;
if (null != value) {
data = null;
if (value.version === LATEST_SNAPSHOT_VERSION) {
data = value.data;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return data;
};
prototype["getClass"] = function getClass() {
return this.constructor;
};
MobileCacheSnapshotStore.allStores = [];
2026-08-24 06:08:38 +00:00
let result = require("set").fileFinishedImporting("stores/MobileCacheSnapshotStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default MobileCacheSnapshotStore;