Is there a touch device?

  1. (('ontouchstart' in window) || (navigator.maxTouchPoints > 0) || (navigator.msMaxTouchPoints > 0))
  2. window.matchMedia("(pointer: coarse)").matches