decord/source/1741_useFrameCallback.js

46 lines
1.3 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1741
2026-07-25 08:10:48 +00:00
// Function ID: 19513
2026-07-20 16:05:17 +00:00
// Name: useFrameCallback
2026-07-23 10:11:24 +00:00
// Dependencies: [31, 1742]
2026-07-20 16:05:17 +00:00
// Exports: useFrameCallback
// Module 1741 (useFrameCallback)
2026-07-23 10:11:24 +00:00
import result from "result";
import importDefaultResult from "FrameCallbackRegistryJS";
let closure_0;
let closure_1;
({ useEffect: closure_0, useRef: closure_1 } = result);
2026-07-20 16:05:17 +00:00
importDefaultResult = new importDefaultResult();
export const useFrameCallback = function useFrameCallback(fn, arg1) {
2026-07-23 10:11:24 +00:00
const callback = fn;
2026-07-20 16:05:17 +00:00
const tmp = arguments.length > 1 && undefined !== arguments[1];
let tmp2 = !tmp;
if (tmp) {
tmp2 = arguments[1];
}
const obj = {
setActive(isActive, arg1, self) {
2026-07-23 10:11:24 +00:00
const result = outer1_2.manageStateFrameCallback(tmp3.current.callbackId, isActive);
2026-07-20 16:05:17 +00:00
tmp3.current.isActive = isActive;
},
isActive: tmp2,
callbackId: -1
};
2026-07-23 10:11:24 +00:00
const tmp3 = callback2(obj);
callback2 = tmp3;
2026-07-20 16:05:17 +00:00
const items = [fn, tmp2];
2026-07-23 10:11:24 +00:00
callback(() => {
tmp3.current.callbackId = outer1_2.registerFrameCallback(current);
current = tmp3.current;
current = tmp3.current;
2026-07-20 16:05:17 +00:00
current.setActive(tmp3.current.isActive);
return () => {
2026-07-23 10:11:24 +00:00
const result = outer2_2.unregisterFrameCallback(current.callbackId);
2026-07-20 16:05:17 +00:00
current.callbackId = -1;
};
}, items);
return tmp3.current;
};