decord/source/modules/gateway/ActionBatcher.tsx

62 lines
1.7 KiB
TypeScript
Raw Normal View History

// Module ID: 13735
// Function ID: 13736
// Name: ActionBatcher
// Dependencies: [573, 2]
2026-07-20 16:05:17 +00:00
// Module 13735 (ActionBatcher)
import DispatcherDefault from "Dispatcher" /* 573 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
2026-07-29 08:29:29 +00:00
let ActionBatcher;
class ActionBatcher {
constructor(arg0, arg1, arg2) {
closure_0 = require;
obj = Object.create(new.target.prototype);
closure_1 = obj;
obj.action = null;
obj.socket = global;
obj.shouldFlush = importDefault;
obj.add = (arg0) => {
obj.action = closure_0(obj.action, arg0);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
batchers = ActionBatcher.batchers;
arr1 = batchers.push(obj);
2026-07-29 08:29:29 +00:00
return obj;
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
ActionBatcher["flush"] = function flush(arg0, arg1) {
const iter = ActionBatcher.batchers[Symbol.iterator]();
const nextResult = iter.next();
while (iter !== undefined) {
let obj = nextResult;
let tmp2 = null != nextResult.action;
if (tmp2) {
let shouldFlushResult = null == arg0;
if (!shouldFlushResult) {
shouldFlushResult = obj.shouldFlush(arg0, arg1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = shouldFlushResult;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (tmp2) {
let flushResult = obj.flush();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
continue;
}
};
ActionBatcher.prototype["flush"] = function flush() {
const self = this;
const action = this.action;
this.action = null;
if (null != action) {
DispatcherDefault.dispatch(action).catch((error) => {
2026-07-29 08:29:29 +00:00
const socket = self.socket;
return socket.resetSocketAndClearCacheOnError({ error, action: action.type });
});
const dispatchResult = DispatcherDefault.dispatch(action);
2026-07-29 08:29:29 +00:00
}
};
ActionBatcher.batchers = [];
const result = size.fileFinishedImporting("modules/gateway/ActionBatcher.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default ActionBatcher;