decord/alpha/source/modules/applications/useGetOrFetchApplicationBatched.tsx

132 lines
3.9 KiB
TypeScript
Raw Normal View History

// Module ID: 11266
// Function ID: 11267
// Name: useGetOrFetchApplicationBatched
// Dependencies: [19, 5072, 2039, 12, 6770, 504, 2]
2026-07-29 08:29:29 +00:00
// Exports: useGetOrFetchApplicationBatched, useRequestApplication
2026-07-20 16:05:17 +00:00
// Module 11266 (useGetOrFetchApplicationBatched)
import Timers from "Timers" /* 2039 */;
import noop from "module_19" /* 19 */;
import ApplicationStore from "ApplicationStore" /* 5072 */;
2026-07-23 10:11:24 +00:00
const require = globalThis.__r;
require = fn;
2026-07-29 08:29:29 +00:00
class ApplicationFetchManager {
constructor() {
obj = Object.create(new.target.prototype);
2026-08-24 06:08:38 +00:00
closure_0 = obj;
2026-07-29 08:29:29 +00:00
map = new Map();
obj._lastFetchedAttempted = map;
set = new Set();
obj._pending = set;
delayedCall = new closure_0(closure_2[2]).DelayedCall(32, () => obj._flush());
2026-07-29 08:29:29 +00:00
obj._flushHandler = delayedCall;
return obj;
}
}
const prototype = ApplicationFetchManager.prototype;
prototype["request"] = function request(arg0) {
const self = this;
const _pending = this._pending;
if (!_pending.has(arg0)) {
const _lastFetchedAttempted = self._lastFetchedAttempted;
value = _lastFetchedAttempted.get(arg0);
2026-07-29 08:29:29 +00:00
let tmp3 = null != value;
if (tmp3) {
const _Date = Date;
tmp3 = Date.now() - value < 60000;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (!tmp3) {
const _pending2 = self._pending;
_pending2.add(arg0);
self._flushHandler.delay(false);
const _flushHandler = self._flushHandler;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
};
prototype["_flush"] = function _flush() {
const self = this;
const items = [];
const _pending1 = this._pending;
const item = _pending1.forEach((item) => {
2026-07-29 08:29:29 +00:00
const _lastFetchedAttempted = self._lastFetchedAttempted;
const result = _lastFetchedAttempted.set(item, Date.now());
items.push(item);
2026-07-29 08:29:29 +00:00
});
const _pending = this._pending;
2026-07-29 08:29:29 +00:00
_pending.clear();
const items1 = [];
const items2 = [];
const item1 = items.forEach((item) => {
if (ApplicationStore.didFetchingApplicationFail(item)) {
items2.push(item);
2026-07-29 08:29:29 +00:00
} else {
items1.push(item);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
});
if (items1.length > 0) {
const obj = items(items1[3]);
const item2 = items(items1[3]).chunk(items1, 20).forEach((item) => {
const applications = items(items1[4]).fetchApplications(item, false);
2026-07-29 08:29:29 +00:00
});
const chunkResult = items(items1[3]).chunk(items1, 20);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (items2.length > 0) {
obj2 = items(items1[3]);
const item3 = items(items1[3]).chunk(items2, 20).forEach((item) => {
const applications = items(items1[4]).fetchApplications(item, true);
2026-07-29 08:29:29 +00:00
});
const chunkResult1 = items(items1[3]).chunk(items2, 20);
}
};
let obj2 = Object.create(ApplicationFetchManager.prototype);
let closure_129_0 = obj2;
obj2._lastFetchedAttempted = new Map();
let map = new Map();
obj2._pending = new Set();
let delayedCall = new fn(2039).DelayedCall(32, () => obj._flush());
obj2._flushHandler = delayedCall;
const size = fn(2);
let result = size.fileFinishedImporting("modules/applications/useGetOrFetchApplicationBatched.tsx");
2026-07-29 08:29:29 +00:00
export const useRequestApplication = function useRequestApplication(arg0) {
2026-08-24 06:08:38 +00:00
closure_0 = arg0;
2026-07-29 08:29:29 +00:00
const items = [arg0];
const effect = noop.useEffect(() => {
2026-07-29 08:29:29 +00:00
let tmp2 = null != closure_0;
if (tmp2) {
tmp2 = "" !== tmp;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp2) {
obj2.request(tmp);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}, items);
};
2026-07-20 16:05:17 +00:00
export const useGetOrFetchApplicationBatched = function useGetOrFetchApplicationBatched(applicationId) {
_require = applicationId;
closure_129_0 = applicationId;
2026-07-29 08:29:29 +00:00
const items = [applicationId];
const effect = noop.useEffect(() => {
2026-07-29 08:29:29 +00:00
let tmp2 = null != closure_0;
if (tmp2) {
tmp2 = "" !== tmp;
}
if (tmp2) {
obj2.request(tmp);
2026-07-29 08:29:29 +00:00
}
}, items);
const items1 = [ApplicationStore];
2026-07-29 08:29:29 +00:00
const items2 = [applicationId];
return require("initialize").useStateFromStores(items1, () => {
2026-07-20 16:05:17 +00:00
let application = null;
2026-07-23 10:11:24 +00:00
if (null != closure_0) {
2026-07-20 16:05:17 +00:00
application = null;
2026-07-29 08:29:29 +00:00
if ("" !== tmp) {
application = ApplicationStore.getApplication(tmp);
2026-07-20 16:05:17 +00:00
}
}
return application;
2026-07-29 08:29:29 +00:00
}, items2);
2026-07-20 16:05:17 +00:00
};