()
| 123 | }; |
| 124 | |
| 125 | const detectTablet = () => { |
| 126 | if (isSSR) { |
| 127 | return false; |
| 128 | } |
| 129 | |
| 130 | if (tablet !== undefined) { |
| 131 | return; |
| 132 | } |
| 133 | |
| 134 | if (internals.ipad) { |
| 135 | tablet = true; |
| 136 | return; |
| 137 | } |
| 138 | |
| 139 | if (internals.touch) { |
| 140 | if (isWindows8OrAbove()) { |
| 141 | tablet = true; |
| 142 | return; |
| 143 | } |
| 144 | |
| 145 | if (internals.chrome && internals.android) { |
| 146 | tablet = !/Mobile Safari\/[.0-9]+/.test(internals.userAgent); |
| 147 | return; |
| 148 | } |
| 149 | |
| 150 | let densityFactor = window.devicePixelRatio ? window.devicePixelRatio : 1; // may be undefined in Windows Phone devices |
| 151 | if (internals.android && isWebkit537OrAbove()) { |
| 152 | densityFactor = 1; |
| 153 | } |
| 154 | |
| 155 | tablet = (Math.min(window.screen.width / densityFactor, window.screen.height / densityFactor) >= 600); |
| 156 | return; |
| 157 | } |
| 158 | |
| 159 | tablet = internals.userAgent.indexOf("Touch") !== -1 || (internals.android && !internals.androidPhone); |
| 160 | }; |
| 161 | |
| 162 | const supportsTouch = (): boolean => internals.touch; |
| 163 | const isSafari = (): boolean => internals.safari; |
no test coverage detected
searching dependent graphs…