decord/source/1781_useEvent.js

35 lines
956 B
JavaScript
Raw Normal View History

2026-08-06 08:05:19 +00:00
// Module ID: 1781
// Function ID: 1782
2026-07-29 08:29:29 +00:00
// Name: useEvent
2026-08-06 08:05:19 +00:00
// Dependencies: [19, 1739]
2026-07-29 08:29:29 +00:00
// Exports: useEvent
2026-08-06 08:05:19 +00:00
// Module 1781 (useEvent)
2026-07-29 08:29:29 +00:00
import { useRef } from "noop";
export const useEvent = function useEvent(fn, closure_4, doDependenciesDiffer) {
let items = closure_4;
if (closure_4 === undefined) {
items = [];
}
let flag = doDependenciesDiffer;
if (doDependenciesDiffer === undefined) {
flag = false;
}
const tmp = useRef(null);
if (null === tmp.current) {
2026-08-06 08:05:19 +00:00
let workletEventHandler = new require(1739) /* importDefaultResult1 */.WorkletEventHandler(fn, items);
2026-07-29 08:29:29 +00:00
let obj = { workletEventHandler: null };
obj[0] = workletEventHandler;
tmp.current = obj;
} else if (flag) {
workletEventHandler = tmp.current.workletEventHandler;
workletEventHandler.updateEventHandler(fn, items);
obj = { workletEventHandler: null };
obj[0] = workletEventHandler;
tmp.current = obj;
}
return tmp.current;
};