UNPKG

@kyverus/react-custom-magnifier

Version:
14 lines (11 loc) 377 B
export const isTouchDevice = () => { const prefixes = ["", "-webkit-", "-moz-", "-o-", "-ms-", ""]; const mq = (query) => window.matchMedia(query).matches; if ( "ontouchstart" in window || (window.DocumentTouch && document instanceof DocumentTouch) ) { return true; } return mq(["(", prefixes.join("touch-enabled),("), ")"].join("")); };