decord/source/modules/gateway/ActionBatcher.tsx

64 lines
1.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 13120
// Function ID: 13121
2026-07-29 08:29:29 +00:00
// Name: flush
// Dependencies: [709, 2]
2026-07-20 16:05:17 +00:00
2026-08-25 06:04:03 +00:00
// Module 13120 (flush)
2026-08-24 06:08:38 +00:00
import set from "set" /* 2 */;
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 = callback(obj.action, arg0);
2026-07-20 16:05:17 +00:00
};
2026-07-29 08:29:29 +00:00
batchers = ActionBatcher.batchers;
arr = batchers.push(obj);
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) {
let tmp4 = nextResult;
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 tmp5 = nextResult;
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) {
const obj = action(self[0]);
action(self[0]).dispatch(action).catch((error) => {
const socket = self.socket;
return socket.resetSocketAndClearCacheOnError({ error, action: action.type });
});
const dispatchResult = action(self[0]).dispatch(action);
}
};
ActionBatcher.batchers = [];
2026-08-24 06:08:38 +00:00
const result = set.fileFinishedImporting("modules/gateway/ActionBatcher.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default ActionBatcher;