UNPKG

485 BJavaScriptView Raw
1export default function () {
2 const feature = {
3 touch: !!(('ontouchstart' in window)
4 || window.navigator && window.navigator.msPointerEnabled && window.MSGesture
5 || window.DocumentTouch && document instanceof DocumentTouch),
6 ie: window.navigator.userAgent.indexOf('MSIE') > 0
7 || !!window.navigator.userAgent.match(/Trident.*rv\:11\./),
8 small: window.matchMedia('(max-width: 34em)').matches
9 }
10
11 return (feature.touch && !feature.ie) || feature.small
12}