2026-09-24 10:59:02 +00:00
|
|
|
// Module ID: 8622
|
|
|
|
|
// Function ID: 8623
|
2026-07-20 16:05:17 +00:00
|
|
|
// Name: usePrevious
|
2026-07-29 08:29:29 +00:00
|
|
|
// Dependencies: [19, 2]
|
2026-07-31 08:44:05 +00:00
|
|
|
// Exports: default, useCurrentWhen, usePreviousWhen
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-09-24 10:59:02 +00:00
|
|
|
// Module 8622 (usePrevious)
|
2026-09-10 05:38:07 +00:00
|
|
|
import noop from "module_19" /* 19 */;
|
|
|
|
|
import size from "module_2" /* 2 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-09-10 05:38:07 +00:00
|
|
|
({ useRef: closure_0, useEffect: closure_1 } = noop);
|
|
|
|
|
const result = size.fileFinishedImporting("hooks/usePrevious.tsx");
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-09-10 05:38:07 +00:00
|
|
|
export default function usePrevious(current) {
|
|
|
|
|
const tmp = React(null);
|
|
|
|
|
closure_1 = tmp;
|
|
|
|
|
const items = [current];
|
|
|
|
|
framebus(() => {
|
|
|
|
|
closure_1.current = current;
|
2026-07-20 16:05:17 +00:00
|
|
|
}, items);
|
|
|
|
|
return tmp.current;
|
|
|
|
|
};
|
|
|
|
|
export const usePreviousWhen = function usePreviousWhen(value) {
|
|
|
|
|
value = value.value;
|
|
|
|
|
const shouldUpdate = value.shouldUpdate;
|
2026-09-10 05:38:07 +00:00
|
|
|
const tmp = React(null);
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_2 = tmp;
|
2026-07-20 16:05:17 +00:00
|
|
|
const items = [value, shouldUpdate];
|
2026-09-10 05:38:07 +00:00
|
|
|
framebus(() => {
|
2026-07-20 16:05:17 +00:00
|
|
|
if (shouldUpdate) {
|
2026-09-10 05:38:07 +00:00
|
|
|
closure_2.current = value;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
}, items);
|
|
|
|
|
return tmp.current;
|
|
|
|
|
};
|
2026-07-31 08:44:05 +00:00
|
|
|
export const useCurrentWhen = function useCurrentWhen(value) {
|
|
|
|
|
let current = value.value;
|
|
|
|
|
const shouldUpdate = value.shouldUpdate;
|
2026-09-10 05:38:07 +00:00
|
|
|
const tmp = React(null);
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_2 = tmp;
|
2026-07-31 08:44:05 +00:00
|
|
|
const items = [current, shouldUpdate];
|
2026-09-10 05:38:07 +00:00
|
|
|
framebus(() => {
|
2026-07-31 08:44:05 +00:00
|
|
|
if (shouldUpdate) {
|
2026-08-24 06:08:38 +00:00
|
|
|
closure_2.current = current;
|
2026-07-31 08:44:05 +00:00
|
|
|
}
|
|
|
|
|
}, items);
|
|
|
|
|
if (!shouldUpdate) {
|
|
|
|
|
current = tmp.current;
|
|
|
|
|
}
|
|
|
|
|
return current;
|
|
|
|
|
};
|