decord/source/5461_useUnmountAwareTimeout.js

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-07-29 08:29:29 +00:00
// Module ID: 5461
// Function ID: 5462
2026-07-20 16:05:17 +00:00
// Name: useUnmountAwareTimeout
2026-07-29 08:29:29 +00:00
// Dependencies: [5416, 19]
2026-07-20 16:05:17 +00:00
// Exports: useUnmountAwareAnimationFrame, useUnmountAwareTimeout
2026-07-29 08:29:29 +00:00
// Module 5461 (useUnmountAwareTimeout)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c3;
let c4;
let obj1;
({ useCallback: obj1, useEffect: c3, useState: c4 } = noop);
2026-07-20 16:05:17 +00:00
export const useUnmountAwareTimeout = function useUnmountAwareTimeout() {
const first = callback(callback4(() => new Set()), 1)[0];
const items = [first];
callback3(() => () => {
2026-07-29 08:29:29 +00:00
const item = closure_0.forEach((arg0) => closure_0.clearTimeout(arg0));
closure_0.clear();
2026-07-20 16:05:17 +00:00
}, items);
const items1 = [first];
return {
setTimeout: callback2((arg0, arg1) => {
const timerId = first.setTimeout(() => {
2026-07-23 10:11:24 +00:00
set.delete(timerId);
set();
2026-07-20 16:05:17 +00:00
}, arg1);
2026-07-23 10:11:24 +00:00
arg0.add(timerId);
2026-07-20 16:05:17 +00:00
}, items1)
};
};
export const useUnmountAwareAnimationFrame = function useUnmountAwareAnimationFrame() {
const first = callback(callback4(() => new Set()), 1)[0];
const items = [first];
callback3(() => () => {
2026-07-29 08:29:29 +00:00
const item = closure_0.forEach((_animationFrame) => cancelAnimationFrame(_animationFrame));
closure_0.clear();
2026-07-20 16:05:17 +00:00
}, items);
const items1 = [first];
return {
requestAnimationFrame: callback2((arg0) => {
const animationFrame = first.requestAnimationFrame((arg0) => {
2026-07-23 10:11:24 +00:00
set.delete(animationFrame);
set(arg0);
2026-07-20 16:05:17 +00:00
});
2026-07-23 10:11:24 +00:00
arg0.add(animationFrame);
2026-07-20 16:05:17 +00:00
}, items1)
};
};