decord/source/hooks/useInterval.tsx

38 lines
1,022 B
TypeScript
Raw Normal View History

// Module ID: 7518
// Function ID: 7519
2026-07-20 16:05:17 +00:00
// Name: useInterval
2026-07-29 08:29:29 +00:00
// Dependencies: [19, 38, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 7518 (useInterval)
import noop from "module_19" /* 19 */;
import size from "module_2" /* 2 */;
2026-07-20 16:05:17 +00:00
({ useEffect: c2, useRef: c3 } = noop);
const result = size.fileFinishedImporting("hooks/useInterval.tsx");
2026-07-20 16:05:17 +00:00
export default function useInterval(current, arg1) {
2026-08-24 06:08:38 +00:00
closure_1 = arg1;
closure_2 = ref(current);
ref = ref(null);
const items = [current];
closure_2(() => {
closure_2.current = current;
2026-07-20 16:05:17 +00:00
}, items);
const items1 = [arg1];
closure_2(() => {
2026-07-23 10:11:24 +00:00
if (null !== closure_1) {
2026-07-20 16:05:17 +00:00
const _setInterval = setInterval;
ref.current = setInterval(() => {
closure_0(closure_1[1])(null != ref.current, "Missing callback");
2026-07-29 08:29:29 +00:00
ref.current();
}, tmp);
return () => clearInterval(ref2.current);
2026-07-20 16:05:17 +00:00
} else if (null !== ref.current) {
const _clearInterval = clearInterval;
2026-07-29 08:29:29 +00:00
clearInterval(tmp2.current);
tmp2.current = null;
2026-07-20 16:05:17 +00:00
}
}, items1);
};