decord/alpha/source/lib/rateLimit.tsx
github-actions 6eea20b8e1 chore: update source for alpha 348.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/05xxx/module_5014.js (118.4 MB)
2026-09-24 10:59:02 +00:00

50 lines
1.2 KiB
TypeScript

// Module ID: 14039
// Function ID: 14040
// Name: rateLimit
// Dependencies: [2]
// Exports: default
// Module 14039 (rateLimit)
import size from "module_2" /* 2 */;
const result = size.fileFinishedImporting("lib/rateLimit.tsx");
export default function rateLimit(arg0, arg1, arg2) {
closure_0 = arg0;
closure_1 = arg1;
closure_2 = arg2;
closure_4 = [];
function wrapper() {
const items = [...arguments];
const timestamp = Date.now();
if (null != timeout) {
const _clearTimeout = clearTimeout;
clearTimeout(timeout);
timeout = null;
}
let arr2 = closure_4;
if (closure_4.length > 0) {
arr2 = tmp4;
if (tmp4[0] <= timestamp) {
closure_4.shift();
arr2 = closure_4;
while (closure_4.length > 0) {
arr2 = tmp5;
if (tmp5[0] > timestamp) {
break;
}
}
}
}
if (arr2.length < items) {
arr2.push(timestamp + closure_1);
const items1 = [];
HermesBuiltin.arraySpread(items, 0);
HermesBuiltin.apply(items1, undefined);
} else {
const _setTimeout = setTimeout;
timeout = setTimeout(() => wrapper(...items), arr2[0] - timestamp);
}
}
return wrapper;
};