decord/source/1477_useOptionsGetters.js

115 lines
3.1 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1477
2026-07-25 08:10:48 +00:00
// Function ID: 17170
2026-07-20 16:05:17 +00:00
// Name: useOptionsGetters
2026-07-23 10:11:24 +00:00
// Dependencies: [31, 1478, 1470]
2026-07-20 16:05:17 +00:00
// Exports: default
// Module 1477 (useOptionsGetters)
2026-07-23 10:11:24 +00:00
import result from "result";
2026-07-20 16:05:17 +00:00
export default function useOptionsGetters(key) {
2026-07-23 10:11:24 +00:00
key = key.key;
2026-07-20 16:05:17 +00:00
const options = key.options;
const navigation = key.navigation;
2026-07-23 10:11:24 +00:00
let closure_3 = navigation.useRef(options);
let closure_4 = navigation.useRef({});
const onOptionsChange = navigation.useContext(key(options[1])).onOptionsChange;
const addOptionsGetter = navigation.useContext(key(options[2])).addOptionsGetter;
2026-07-20 16:05:17 +00:00
const items = [navigation, onOptionsChange];
2026-07-23 10:11:24 +00:00
const callback = navigation.useCallback(() => {
2026-07-20 16:05:17 +00:00
let isFocusedResult;
if (null != navigation) {
isFocusedResult = navigation.isFocused();
}
let tmp3 = null == isFocusedResult || isFocusedResult;
if (tmp3) {
2026-07-23 10:11:24 +00:00
tmp3 = !Object.keys(closure_4.current).length;
2026-07-20 16:05:17 +00:00
}
if (tmp3) {
let current = ref.current;
if (null == current) {
current = {};
}
onOptionsChange(current);
const tmp4 = onOptionsChange;
}
}, items);
const items1 = [navigation, options, callback];
2026-07-23 10:11:24 +00:00
const effect = navigation.useEffect(() => {
2026-07-20 16:05:17 +00:00
closure_3.current = options;
let addListenerResult;
callback();
if (null != navigation) {
addListenerResult = navigation.addListener("focus", callback);
}
return addListenerResult;
}, items1);
2026-07-23 10:11:24 +00:00
const callback1 = navigation.useCallback(() => {
2026-07-20 16:05:17 +00:00
for (const key10007 in closure_4.current) {
let tmp6 = key10007;
let tmp7 = closure_4;
let current2 = closure_4.current;
if (!current2.hasOwnProperty(key10007)) {
continue;
} else {
let tmp = closure_4;
let current = closure_4.current;
let obj = current[key10007];
let callResult;
if (null != obj) {
callResult = obj.call(current);
}
let tmp3 = obj;
let tmp4 = current;
let tmp5 = callResult;
if (null === callResult) {
continue;
} else {
return callResult;
}
}
continue;
}
return null;
}, []);
const items2 = [navigation, callback1];
2026-07-23 10:11:24 +00:00
const callback2 = navigation.useCallback(() => {
2026-07-20 16:05:17 +00:00
let isFocusedResult;
if (null != navigation) {
isFocusedResult = navigation.isFocused();
}
if (null != isFocusedResult) {
if (!isFocusedResult) {
return null;
}
}
let current = callback1();
if (null === current) {
current = ref.current;
}
return current;
}, items2);
2026-07-23 10:11:24 +00:00
const items3 = [callback2, addOptionsGetter, key];
const effect1 = navigation.useEffect(() => {
2026-07-20 16:05:17 +00:00
let tmp;
if (null != addOptionsGetter) {
tmp = addOptionsGetter(key, callback2);
}
return tmp;
}, items3);
const items4 = [callback];
return {
2026-07-23 10:11:24 +00:00
addOptionsGetter: navigation.useCallback((arg0, arg1) => {
let closure_0 = arg0;
closure_4.current[arg0] = arg1;
2026-07-20 16:05:17 +00:00
callback();
return () => {
2026-07-23 10:11:24 +00:00
delete tmp2[tmp];
outer1_7();
2026-07-20 16:05:17 +00:00
};
}, items4),
getCurrentOptions: callback2
};
};