1 | import { getWindow, getDocument } from 'ssr-window';
|
2 | let support;
|
3 |
|
4 | function calcSupport() {
|
5 | const window = getWindow();
|
6 | const document = getDocument();
|
7 | return {
|
8 | smoothScroll: document.documentElement && 'scrollBehavior' in document.documentElement.style,
|
9 | touch: !!('ontouchstart' in window || window.DocumentTouch && document instanceof window.DocumentTouch),
|
10 | passiveListener: function checkPassiveListener() {
|
11 | let supportsPassive = false;
|
12 |
|
13 | try {
|
14 | const opts = Object.defineProperty({}, 'passive', {
|
15 |
|
16 | get() {
|
17 | supportsPassive = true;
|
18 | }
|
19 |
|
20 | });
|
21 | window.addEventListener('testPassiveListener', null, opts);
|
22 | } catch (e) {
|
23 | }
|
24 |
|
25 | return supportsPassive;
|
26 | }(),
|
27 | gestures: function checkGestures() {
|
28 | return 'ongesturestart' in window;
|
29 | }()
|
30 | };
|
31 | }
|
32 |
|
33 | function getSupport() {
|
34 | if (!support) {
|
35 | support = calcSupport();
|
36 | }
|
37 |
|
38 | return support;
|
39 | }
|
40 |
|
41 | export { getSupport }; |
\ | No newline at end of file |