|
|
@ -1,3 +1,5 @@ |
|
|
|
import detectPassiveEvents from 'detect-passive-events'; |
|
|
|
|
|
|
|
const LAYOUT_BREAKPOINT = 1024; |
|
|
|
|
|
|
|
export function isMobile(width) { |
|
|
@ -5,11 +7,16 @@ export function isMobile(width) { |
|
|
|
}; |
|
|
|
|
|
|
|
const iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream; |
|
|
|
|
|
|
|
let userTouching = false; |
|
|
|
let listenerOptions = detectPassiveEvents.hasSupport ? { passive: true } : false; |
|
|
|
|
|
|
|
window.addEventListener('touchstart', () => { |
|
|
|
function touchListener() { |
|
|
|
userTouching = true; |
|
|
|
}, { once: true }); |
|
|
|
window.removeEventListener('touchstart', touchListener, listenerOptions); |
|
|
|
} |
|
|
|
|
|
|
|
window.addEventListener('touchstart', touchListener, listenerOptions); |
|
|
|
|
|
|
|
export function isUserTouching() { |
|
|
|
return userTouching; |
|
|
|