decord/source/modules/cache/CacheManager.native.tsx

83 lines
2.8 KiB
TypeScript
Raw Normal View History

// Module ID: 17327
// Function ID: 17328
2026-07-29 08:29:29 +00:00
// Name: handleConnectionOpen
// Dependencies: [5277, 7476, 3, 1090, 7118, 7654, 15573, 1115, 1093, 2]
2026-07-20 16:05:17 +00:00
// Module 17327 (handleConnectionOpen)
2026-08-24 06:08:38 +00:00
import timestampDefault from "timestamp" /* 3 */;
import setDefault from "set" /* 1090 */;
import keys from "keys" /* 1093 */;
import set from "set" /* 1115 */;
import initializeDefault from "initialize" /* 7118 */;
import okAsyncDefault from "okAsync" /* 7654 */;
import _writeCaches from "_writeCaches" /* 15573 */;
import closure_3 from "_handleConnectionOpen" /* 5277 */;
import closure_4 from "handleClearCaches" /* 7476 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
let closure_5 = new timestampDefault("CacheStore");
let closure_6 = 15 * setDefault.Millis.MINUTE;
initializeDefault;
2026-07-29 08:29:29 +00:00
class CacheManager extends tmp3 {
constructor() {
applyArgumentsResult = HermesBuiltin.applyArguments(new.target, new.target);
closure_0 = applyArgumentsResult;
applyArgumentsResult.actions = {
POST_CONNECTION_OPEN: applyArgumentsResult.handleConnectionOpen,
CONNECTION_CLOSED: applyArgumentsResult.handleConnectionClose,
APP_STATE_UPDATE(arg0) {
return applyArgumentsResult.handleAppStateUpdate(arg0);
},
WINDOW_FOCUS(arg0) {
return applyArgumentsResult.handleWindowFocus(arg0);
}
};
return applyArgumentsResult;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
const prototype = CacheManager.prototype;
prototype["handleConnectionOpen"] = function handleConnectionOpen() {
2026-08-24 06:08:38 +00:00
const result = okAsyncDefault.doesDatabaseVersionMatchJsConstants();
2026-07-29 08:29:29 +00:00
result.then((arg0) => {
if (!arg0) {
callback(table[6]).writeCaches();
const obj = callback(table[6]);
}
});
};
prototype["handleConnectionClose"] = function handleConnectionClose() {
return false;
};
prototype["handleAppStateUpdate"] = function handleAppStateUpdate(state) {
2026-08-24 06:08:38 +00:00
const obj = set;
2026-07-29 08:29:29 +00:00
const tmp = require;
2026-08-24 06:08:38 +00:00
const AppStates = keys.AppStates;
let isConnectedResult = (set.isAndroid() ? AppStates.BACKGROUND : AppStates.INACTIVE) === state.state;
2026-07-29 08:29:29 +00:00
if (isConnectedResult) {
isConnectedResult = connected.isConnected();
}
if (isConnectedResult) {
2026-08-24 06:08:38 +00:00
_writeCaches.writeCaches();
const tmpResult = _writeCaches;
2026-07-29 08:29:29 +00:00
}
return false;
};
prototype["handleWindowFocus"] = function handleWindowFocus(focused) {
if (!focused.focused) {
const _Date = Date;
if (Date.now() - lastWriteTime.lastWriteTime > closure_6) {
2026-08-24 06:08:38 +00:00
closure_5.verbose("Writing cache from window unfocus");
_writeCaches.writeCaches();
const obj = _writeCaches;
2026-07-29 08:29:29 +00:00
} else {
2026-08-24 06:08:38 +00:00
closure_5.verbose("Not writing cache from window unfocus");
2026-07-29 08:29:29 +00:00
}
}
return false;
};
const cacheManager = new CacheManager();
2026-08-24 06:08:38 +00:00
const tmp2 = new timestampDefault("CacheStore");
let result = require("set").fileFinishedImporting("modules/cache/CacheManager.native.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default cacheManager;