decord/alpha/source/hooks/useLeadingEdgeDebounce.tsx

80 lines
2 KiB
TypeScript
Raw Normal View History

2026-10-10 08:08:14 +00:00
// Module ID: 10963
// Function ID: 10964
2026-07-20 16:05:17 +00:00
// Name: useLeadingEdgeDebounce
2026-10-03 08:58:59 +00:00
// Dependencies: [32, 19, 558, 576, 2]
2026-07-20 16:05:17 +00:00
2026-10-10 08:08:14 +00:00
// Module 10963 (useLeadingEdgeDebounce)
2026-10-03 08:58:59 +00:00
import react2 from "react" /* 576 */;
import _slicedToArray from "_slicedToArray" /* 32 */;
import react from "react" /* 19 */;
import ReactCompilerGating from "ReactCompilerGating" /* 558 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const tmp2 = ReactCompilerGating.isReactCompilerEnabled() ? ((arg0, arg1) => {
let closure_3;
let closure_0 = arg0;
let closure_1 = arg1;
const obj = react2;
const cResult = obj.c(4);
let closure_2 = react.useRef(true);
[, closure_3] = react.useState(arg0);
const obj2 = react;
if (cResult[0] === arg1) {
let tmp4;
let tmp5;
if (cResult[1] === arg0) {
tmp4 = cResult[2];
tmp5 = cResult[3];
}
const effect = obj2.useEffect(tmp4, tmp5);
return tmp3;
}
const fn = function s() {
const timeout = setTimeout(() => {
closure_1_3(closure_0);
ref.current = true;
}, closure_1);
const tmp = ref;
if (ref.current) {
closure_3(timeout);
}
tmp.current = false;
return () => {
clearTimeout(closure_0);
};
};
const items = [arg0, arg1];
cResult[0] = arg1;
cResult[1] = arg0;
cResult[2] = fn;
cResult[3] = items;
tmp5 = items;
tmp4 = fn;
}) : ((arg0, arg1) => {
let closure_3;
let first;
let closure_0 = arg0;
let closure_1 = arg1;
let closure_2 = react.useRef(true);
[first, closure_3] = react.useState(arg0);
2026-07-20 16:05:17 +00:00
const items = [arg0, arg1];
2026-10-03 08:58:59 +00:00
const effect = react.useEffect(() => {
2026-07-20 16:05:17 +00:00
const timeout = setTimeout(() => {
closure_1_3(closure_0);
ref.current = true;
2026-08-24 06:08:38 +00:00
}, closure_1);
2026-10-03 08:58:59 +00:00
const tmp = ref;
2026-07-20 16:05:17 +00:00
if (ref.current) {
closure_3(timeout);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp.current = false;
2026-07-20 16:05:17 +00:00
return () => {
2026-08-24 06:08:38 +00:00
clearTimeout(closure_0);
2026-07-20 16:05:17 +00:00
};
}, items);
2026-10-03 08:58:59 +00:00
return first;
});
const result = size.fileFinishedImporting("hooks/useLeadingEdgeDebounce.tsx");
export const useLeadingEdgeDebounce = tmp2;