code: function addListener(eventType, fn){
    if (document.addEventListener) {
      document.addEventListener(eventType, fn, false);
    } else {
      document.attachEvent("on" + eventType, fn);
    }
  }
docs: ------------------------------ Attach global event listener ------------------------------