decord/source/1471_useSyncState.js

63 lines
1.5 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1471
2026-07-25 08:10:48 +00:00
// Function ID: 17123
2026-07-20 16:05:17 +00:00
// Name: useSyncState
2026-07-23 10:11:24 +00:00
// Dependencies: [57, 31]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 1471 (useSyncState)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
import result from "result";
2026-07-20 16:05:17 +00:00
let closure_2 = {};
export default function useSyncState(arg0) {
const ref = React.useRef(closure_2);
2026-07-23 10:11:24 +00:00
React = React.useRef(false);
2026-07-20 16:05:17 +00:00
closure_2 = React.useRef(true);
const effect = React.useEffect(() => {
closure_2.current = true;
return () => {
2026-07-23 10:11:24 +00:00
outer1_2.current = false;
2026-07-20 16:05:17 +00:00
};
}, []);
if (ref.current === closure_2) {
let tmp3 = arg0;
if ("function" === typeof arg0) {
tmp3 = arg0();
}
ref.current = tmp3;
}
2026-07-23 10:11:24 +00:00
const tmp4 = ref(React.useState(ref.current), 2);
let closure_3 = tmp5;
const callback = React.useCallback(() => ref.current, []);
2026-07-20 16:05:17 +00:00
const callback1 = React.useCallback((current) => {
current = current !== ref.current;
if (current) {
current = ref2.current;
}
if (current) {
ref.current = current;
if (!ref.current) {
2026-07-23 10:11:24 +00:00
tmp5 = tmp5(current);
2026-07-20 16:05:17 +00:00
}
}
}, []);
const callback2 = React.useCallback((arg0) => {
2026-07-23 10:11:24 +00:00
result.current = true;
2026-07-20 16:05:17 +00:00
arg0();
2026-07-23 10:11:24 +00:00
result.current = false;
2026-07-20 16:05:17 +00:00
}, []);
const callback3 = React.useCallback(() => {
if (ref2.current) {
tmp5(ref.current);
}
}, []);
if (tmp4[0] !== ref.current) {
tmp5(ref.current);
}
2026-07-23 10:11:24 +00:00
let current = ref.current;
2026-07-20 16:05:17 +00:00
const debugValue = React.useDebugValue(current);
const items = [current, callback, callback1, callback2, callback3];
return items;
};