decord/source/__polyfill/01xxx/module_1562.js
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

71 lines
1.9 KiB
JavaScript

// Module ID: 1562
// Function ID: 1563
// Dependencies: [19, 1527]
// Exports: useFocusEvents
// Module 1562
import NavigationContext from "NavigationContext" /* 1527 */;
import noop from "module_19" /* 19 */;
require = arg1;
export const useFocusEvents = function useFocusEvents(arg0) {
({ state, emitter } = arg0);
const context = noop.useContext(NavigationContext.NavigationContext);
noop.useRef(undefined);
const key = state.routes[state.index].key;
const items = [key, emitter, context];
const effect = noop.useEffect(() => {
let addListenerResult;
if (context != null) {
addListenerResult = context.addListener("focus", () => {
ref.current = target;
emitter.emit({ type: "focus", target });
});
}
return addListenerResult;
}, items);
const items1 = [key, emitter, context];
const effect1 = noop.useEffect(() => {
let addListenerResult;
if (context != null) {
addListenerResult = context.addListener("blur", () => {
ref.current = undefined;
emitter.emit({ type: "blur", target });
});
}
return addListenerResult;
}, items1);
const items2 = [key, emitter, context];
const effect2 = noop.useEffect(() => {
const current = ref.current;
let isFocusedResult = !context;
if (context) {
isFocusedResult = obj.isFocused();
}
if (isFocusedResult) {
ref.current = key;
}
let tmp5 = tmp4;
if (undefined === current) {
tmp5 = obj;
}
if (!tmp5) {
const obj2 = { type: "focus", target: key };
emitter.emit(obj2);
}
let tmp10 = current !== key;
if (tmp10) {
tmp10 = isFocusedResult;
}
if (tmp10) {
tmp10 = tmp4;
}
if (tmp10) {
const obj3 = { type: "blur", target: current };
emitter.emit(obj3);
const obj4 = { type: "focus", target: key };
emitter.emit(obj4);
}
}, items2);
};