UNPKG

detect-touch-events

Version:

Detect if the browser supports the touch events api

12 lines (10 loc) 295 B
const detectTouchEvents = { update() { if (typeof window !== 'undefined') { detectTouchEvents.hasSupport = 'ontouchstart' in window; detectTouchEvents.browserSupportsApi = Boolean(window.TouchEvent); } }, }; detectTouchEvents.update(); export default detectTouchEvents;