decord/source/modules/applications/useGetOrFetchApplicationBatched.tsx

126 lines
3.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 11123
// Function ID: 11124
2026-07-29 08:29:29 +00:00
// Name: request
2026-08-25 06:04:03 +00:00
// Dependencies: [19, 4421, 4264, 12, 5835, 589, 2]
2026-07-29 08:29:29 +00:00
// Exports: useGetOrFetchApplicationBatched, useRequestApplication
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 11123 (request)
2026-08-24 06:08:38 +00:00
import closure_3 from "noop" /* 19 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "addApplication" /* 4421 */;
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
let set = arg1;
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 require("start").DelayedCall(32, () => obj._flush());
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;
const value = _lastFetchedAttempted.get(arg0);
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 = [];
let _pending = this._pending;
const item = _pending.forEach((arg0) => {
const _lastFetchedAttempted = self._lastFetchedAttempted;
const result = _lastFetchedAttempted.set(arg0, Date.now());
items.push(arg0);
});
_pending = this._pending;
_pending.clear();
const items1 = [];
const items2 = [];
const item1 = items.forEach((applicationId) => {
2026-08-24 06:08:38 +00:00
if (closure_1_4.didFetchingApplicationFail(applicationId)) {
2026-07-29 08:29:29 +00:00
items2.push(applicationId);
} else {
items1.push(applicationId);
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((arg0) => {
const applications = items(items1[4]).fetchApplications(arg0, false);
});
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) {
const obj2 = items(items1[3]);
const item3 = items(items1[3]).chunk(items2, 20).forEach((arg0) => {
const applications = items(items1[4]).fetchApplications(arg0, true);
});
const chunkResult1 = items(items1[3]).chunk(items2, 20);
}
};
2026-08-24 06:08:38 +00:00
set = Object.create(ApplicationFetchManager.prototype);
2026-07-29 08:29:29 +00:00
set._lastFetchedAttempted = new Map();
set = new Set();
set._pending = set;
let delayedCall = new require("start").DelayedCall(32, () => obj._flush());
set._flushHandler = delayedCall;
let result = set.fileFinishedImporting("modules/applications/useGetOrFetchApplicationBatched.tsx");
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 = React.useEffect(() => {
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) {
2026-08-24 06:08:38 +00:00
closure_1_5.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) {
2026-07-29 08:29:29 +00:00
const items = [applicationId];
const effect = React.useEffect(() => {
let tmp2 = null != closure_0;
if (tmp2) {
tmp2 = "" !== tmp;
}
if (tmp2) {
2026-08-24 06:08:38 +00:00
closure_1_5.request(tmp);
2026-07-29 08:29:29 +00:00
}
}, items);
2026-08-24 06:08:38 +00:00
const items1 = [closure_4];
2026-07-29 08:29:29 +00:00
const items2 = [applicationId];
2026-08-24 06:08:38 +00:00
return applicationId(589).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) {
2026-08-24 06:08:38 +00:00
application = closure_1_4.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
};