decord/source/modules/activities/useIframeLifecycle.tsx

67 lines
1.9 KiB
TypeScript
Raw Normal View History

// Module ID: 9735
// Function ID: 9736
2026-08-06 08:05:19 +00:00
// Name: useIframeLifecycle
// Dependencies: [19, 1074, 1109, 2]
2026-08-06 08:05:19 +00:00
// Exports: default
// Module 9735 (useIframeLifecycle)
import ComponentDispatchUtils from "ComponentDispatchUtils" /* 1109 */;
import noop from "module_19" /* 19 */;
2026-08-06 08:05:19 +00:00
require = fn;
const ComponentActions = fn(1074).ComponentActions;
const size = fn(2);
const result = size.fileFinishedImporting("modules/activities/useIframeLifecycle.tsx");
2026-08-06 08:05:19 +00:00
export default function useIframeLifecycle(id) {
2026-08-06 08:05:19 +00:00
let obj = arg1;
if (arg1 === undefined) {
obj = {};
}
const onIframeMount = obj.onIframeMount;
const onIframeUnmount = obj.onIframeUnmount;
let flag = obj.isNewIframe;
if (flag === undefined) {
flag = true;
}
let flag2 = obj.isIframeRetiring;
if (flag2 === undefined) {
flag2 = true;
}
onIframeUnmount.useRef(onIframeMount);
2026-08-06 08:05:19 +00:00
closure_6 = onIframeUnmount.useRef(onIframeUnmount);
onIframeUnmount.useRef(flag);
2026-08-06 08:05:19 +00:00
closure_8 = onIframeUnmount.useRef(flag2);
const effect = onIframeUnmount.useEffect(() => {
closure_5.current = onIframeMount;
closure_6.current = onIframeUnmount;
closure_7.current = flag;
closure_8.current = flag2;
});
const items = [id];
2026-08-06 08:05:19 +00:00
const effect1 = onIframeUnmount.useEffect(() => {
if (ref2.current) {
let ComponentDispatch = ComponentDispatchUtils.ComponentDispatch;
let obj = { id };
ComponentDispatch.dispatch(ComponentActions.IFRAME_MOUNT, obj);
2026-08-06 08:05:19 +00:00
let current = ref.current;
if (current != null) {
current(tmp4);
}
tmp4 = id;
2026-08-06 08:05:19 +00:00
}
return () => {
if (ref2.current) {
const ComponentDispatch = id(onIframeMount[2]).ComponentDispatch;
const obj = { id };
ComponentDispatch.dispatch(flag.IFRAME_UNMOUNT, obj);
2026-08-06 08:05:19 +00:00
const current = ref.current;
if (current != null) {
current(tmp4);
}
tmp4 = id;
2026-08-06 08:05:19 +00:00
}
};
}, items);
};