decord/source/1771_useEventHandlerRegistration.js

55 lines
1.7 KiB
JavaScript
Raw Normal View History

2026-07-20 16:05:17 +00:00
// Module ID: 1771
2026-07-25 08:10:48 +00:00
// Function ID: 19746
2026-07-20 16:05:17 +00:00
// Name: useEventHandlerRegistration
2026-07-23 10:11:24 +00:00
// Dependencies: [31, 27, 1772]
2026-07-20 16:05:17 +00:00
// Exports: useAnimatedValue, useEventHandlerRegistration
// Module 1771 (useEventHandlerRegistration)
2026-07-23 10:11:24 +00:00
import { useRef } from "result";
import { Animated } from "get ActivityIndicator";
2026-07-20 16:05:17 +00:00
export function useEventHandlerRegistration(arg0) {
2026-07-23 10:11:24 +00:00
let closure_0 = arg0;
2026-07-20 16:05:17 +00:00
return function onRegisterHandler(arg0) {
function attachWorkletHandlers() {
2026-07-23 10:11:24 +00:00
const findNodeHandleResult = ref(outer2_1[2]).findNodeHandle(ref.current);
2026-07-20 16:05:17 +00:00
if (findNodeHandleResult) {
2026-07-23 10:11:24 +00:00
if ("workletEventHandler" in ref) {
2026-07-20 16:05:17 +00:00
obj2.workletEventHandler.registerForEvents(findNodeHandleResult);
const workletEventHandler = obj2.workletEventHandler;
} else {
obj2.registerForEvents(findNodeHandleResult);
}
}
}
if (arg0.current) {
const result = attachWorkletHandlers();
} else {
const _queueMicrotask = queueMicrotask;
queueMicrotask(attachWorkletHandlers);
}
return () => {
2026-07-23 10:11:24 +00:00
const findNodeHandleResult = ref(outer2_1[2]).findNodeHandle(ref.current);
2026-07-20 16:05:17 +00:00
if (findNodeHandleResult) {
2026-07-23 10:11:24 +00:00
if ("workletEventHandler" in ref) {
2026-07-20 16:05:17 +00:00
obj2.workletEventHandler.unregisterFromEvents(findNodeHandleResult);
const workletEventHandler = obj2.workletEventHandler;
} else {
obj2.unregisterFromEvents(findNodeHandleResult);
}
}
};
};
}
export const useAnimatedValue = function useAnimatedValue(arg0, arg1) {
const tmp = useRef(null);
if (null === tmp.current) {
const Value = Animated.Value;
const prototype = Value.prototype;
const value = new Value(arg0, arg1);
tmp.current = value;
}
return tmp.current;
};