Files
discord-decomp/_bundle/Module1765.js
T
2026-11-01 12:12:55 +02:00

30 lines
857 B
JavaScript

// Metro module 1765 (f1766).
import { useEffect, useRef } from "react";
import FrameCallbackRegistryJS from "./FrameCallbackRegistryJS";
let c1491_2 = new FrameCallbackRegistryJS();
export function useFrameCallback(a0) {
let c13214_0 = a0;
let isActive = arguments[1];
if (isActive === void 0) {
isActive = true;
}
const ref = useRef({
setActive: (a0) => {
c1491_2.manageStateFrameCallback(ref.current.callbackId, a0);
ref.current.isActive = a0;
},
isActive,
callbackId: -1
});
useEffect(() => {
ref.current.callbackId = c1491_2.registerFrameCallback(c13214_0);
const current = ref.current;
ref.current.setActive(ref.current.isActive);
return () => {
c1491_2.unregisterFrameCallback(current.callbackId);
current.callbackId = -1;
};
}, [a0, isActive]);
return ref.current;
}