decord/source/hooks/usePrevious.tsx
github-actions cd74c1f217 chore: update source for alpha 345.5
Skipped 1 file(s) >100MB (GitHub limit): source/__vendor/09xxx/9667_m.js (378 MB)
2026-09-05 10:56:28 +00:00

55 lines
1.4 KiB
TypeScript

// Module ID: 8272
// Function ID: 8273
// Name: usePrevious
// Dependencies: [19, 2]
// Exports: default, useCurrentWhen, usePreviousWhen
// Module 8272 (usePrevious)
import set from "set" /* 2 */;
import noop from "noop" /* 19 */;
({ useRef: c0, useEffect: closure_1 } = noop);
const result = set.fileFinishedImporting("hooks/usePrevious.tsx");
export default function usePrevious(arg0) {
const callback = arg0;
const tmp = callback(null);
const callback2 = tmp;
const items = [arg0];
callback2(() => {
closure_1.current = closure_0;
}, items);
return tmp.current;
};
export const usePreviousWhen = function usePreviousWhen(value) {
value = value.value;
const callback = value;
const shouldUpdate = value.shouldUpdate;
closure_2 = undefined;
const tmp = callback(null);
closure_2 = tmp;
const items = [value, shouldUpdate];
shouldUpdate(() => {
if (shouldUpdate) {
closure_2.current = closure_0;
}
}, items);
return tmp.current;
};
export const useCurrentWhen = function useCurrentWhen(value) {
let current = value.value;
const shouldUpdate = value.shouldUpdate;
closure_2 = undefined;
const tmp = current(null);
closure_2 = tmp;
const items = [current, shouldUpdate];
shouldUpdate(() => {
if (shouldUpdate) {
closure_2.current = current;
}
}, items);
if (!shouldUpdate) {
current = tmp.current;
}
return current;
};