in packages/bui-utils/src/hooks/useTouchEmulator.ts [141:161]
export default function useTouchEmulator(dom: HTMLElement | Window = window) {
const touchStart = onMouse('touchstart');
const touchMove = onMouse('touchmove');
const touchEnd = onMouse('touchend');
useEffect(() => {
if (dom) {
dom.addEventListener('mousedown', touchStart, true);
dom.addEventListener('mousemove', touchMove, true);
dom.addEventListener('mouseup', touchEnd, true);
}
return () => {
if (dom) {
dom.removeEventListener('mousedown', touchStart, true);
dom.removeEventListener('mousemove', touchMove, true);
dom.removeEventListener('mouseup', touchEnd, true);
}
};
}, [dom]);
}