Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Beware of passive event listeners Reply To: Beware of passive event listeners

#285778
Shikkediel
Participant

IE is throwing an error despite the try block. It accepts this however:

function hasQuiet() {

  var cold = false,
  hike = function() {};

  try {
  var aid = Object.defineProperty({}, 'passive', {
  get: function() {cold = true}
  });
  window.addEventListener('test', hike, aid);
  window.removeEventListener('test', hike, aid);
  } catch (e) {}

  return cold;
}