touchstart 事件与 click 事件的冲突

const clickEvent = (function() {

  if ('ontouchstart' in document.documentElement === true)
    return 'touchstart';
  else
    return 'click';
})();
 
Button.addEventListener(clickEvent, e => {
  console.log("things happened!")
})
原文地址:https://www.cnblogs.com/liangxuru/p/8557642.html