Created
September 12, 2019 10:45
-
-
Save tenthree/1d029e57b3fbdd121f221799b1272f0f to your computer and use it in GitHub Desktop.
detect passive event listener in browser
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export let supportsPassive = false | |
if (typeof window !== 'undefined') { | |
supportsPassive = false | |
try { | |
var options = Object.defineProperty({}, 'passive', { | |
get () { | |
supportsPassive = true | |
}, | |
}) | |
window.addEventListener('test', null, options) | |
} catch (err) {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment