Skip to content

Commit f8ccfce

Browse files
authored
Update index.js
1 parent 5854e6d commit f8ccfce

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

index.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,15 @@ let _throttle = require('lodash.throttle')
44

55
let supportsPassive = false
66
try {
7-
if (typeof window === 'undefined') {
8-
return;
7+
if (typeof window !== 'undefined') {
8+
var opts = Object.defineProperty({}, 'passive', {
9+
get: function() {
10+
supportsPassive = true
11+
},
12+
})
13+
window.addEventListener('testPassive', null, opts)
14+
window.removeEventListener('testPassive', null, opts)
915
}
10-
var opts = Object.defineProperty({}, 'passive', {
11-
get: function() {
12-
supportsPassive = true
13-
},
14-
})
15-
window.addEventListener('testPassive', null, opts)
16-
window.removeEventListener('testPassive', null, opts)
1716
} catch (e) {}
1817

1918
let getPosition = () => {

0 commit comments

Comments
 (0)