12 lines
386 B
JavaScript
12 lines
386 B
JavaScript
// Test via a getter in the options object to see if the passive property is accessed
|
|
let supportsPassive = false;
|
|
try {
|
|
const opts = Object.defineProperty({}, 'passive', {
|
|
get() {
|
|
supportsPassive = true;
|
|
}
|
|
});
|
|
window.addEventListener('testPassive', null, opts);
|
|
window.removeEventListener('testPassive', null, opts);
|
|
} catch (e) {}
|
|
export default supportsPassive; |