supportsPassive.js 398 B

123456789101112
  1. // Test via a getter in the options object to see if the passive property is accessed
  2. var supportsPassive = false;
  3. try {
  4. var opts = Object.defineProperty({}, 'passive', {
  5. get: function get() {
  6. supportsPassive = true;
  7. }
  8. });
  9. window.addEventListener('testPassive', null, opts);
  10. window.removeEventListener('testPassive', null, opts);
  11. } catch (e) {}
  12. export default supportsPassive;