decord/source/5443_useUnmountAwareTimeout.js

52 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-07-28 08:39:19 +00:00
// Module ID: 5443
// Function ID: 46517
2026-07-20 16:05:17 +00:00
// Name: useUnmountAwareTimeout
2026-07-28 08:39:19 +00:00
// Dependencies: [5394, 31]
2026-07-20 16:05:17 +00:00
// Exports: useUnmountAwareAnimationFrame, useUnmountAwareTimeout
2026-07-28 08:39:19 +00:00
// Module 5443 (useUnmountAwareTimeout)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import result from "result";
let closure_2;
let closure_3;
let closure_4;
({ useCallback: closure_2, useEffect: closure_3, useState: closure_4 } = result);
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-23 10:11:24 +00:00
const item = outer1_0.forEach((arg0) => first.clearTimeout(arg0));
outer1_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-24 07:16:23 +00:00
const item = outer1_0.forEach((closure_0) => cancelAnimationFrame(closure_0));
2026-07-23 10:11:24 +00:00
outer1_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)
};
};