Skip to content

Commit 07990dc

Browse files
committed
move testForPassiveScroll to own file; export from util index
1 parent f18fada commit 07990dc

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/utils/index.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,4 @@ export getParallaxOffsets from './getParallaxOffsets';
33
export isElementInView from './isElementInView';
44
export parseValueAndUnit from './parseValueAndUnit';
55
export scaleBetween from './scaleBetween';
6-
7-
export function testForPassiveScroll() {
8-
let supportsPassiveOption = false;
9-
try {
10-
const opts = Object.defineProperty({}, 'passive', {
11-
get: function() {
12-
supportsPassiveOption = true;
13-
},
14-
});
15-
window.addEventListener('test', null, opts);
16-
window.removeEventListener('test', null, opts);
17-
} catch (e) {}
18-
return supportsPassiveOption;
19-
}
20-
6+
export testForPassiveScroll from './testForPassiveScroll';

src/utils/testForPassiveScroll.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
export default function testForPassiveScroll() {
2+
let supportsPassiveOption = false;
3+
try {
4+
const opts = Object.defineProperty({}, 'passive', {
5+
get: function() {
6+
supportsPassiveOption = true;
7+
},
8+
});
9+
window.addEventListener('test', null, opts);
10+
window.removeEventListener('test', null, opts);
11+
} catch (e) {}
12+
return supportsPassiveOption;
13+
}

0 commit comments

Comments
 (0)