()
| 10 | |
| 11 | // Browser adapter for touch-mode detection. Decision logic lives in touchDevicePolicy. |
| 12 | function getCurrentTouchEnvironment(): TouchEnvironment { |
| 13 | if (typeof window === 'undefined') { |
| 14 | return {}; |
| 15 | } |
| 16 | |
| 17 | return { |
| 18 | matchMedia: typeof window.matchMedia === 'function' |
| 19 | ? window.matchMedia.bind(window) |
| 20 | : undefined, |
| 21 | maxTouchPoints: typeof navigator === 'undefined' ? 0 : navigator.maxTouchPoints, |
| 22 | hasTouchStart: 'ontouchstart' in window, |
| 23 | }; |
| 24 | } |
| 25 | |
| 26 | function subscribeToTouchMediaChanges(onChange: () => void): () => void { |
| 27 | const mediaQueries = TOUCH_CAPABILITY_MEDIA_QUERIES.map((query) => |
no outgoing calls
no test coverage detected