lingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
17 lines • 502 B
JavaScript
import { useEffect, useRef } from "preact/hooks";
import { stopPropagation } from "../utils/stopPropagation";
export default (cb) => {
const elRef = useRef(null);
useEffect(() => {
const el = elRef.current;
if (!el || !cb)
return;
stopPropagation(el);
el.addEventListener("mousedown", cb);
return () => {
el.removeEventListener("mousedown", cb);
};
}, []);
return elRef;
};
//# sourceMappingURL=useMouseDown.js.map