MCPcopy Create free account
hub / github.com/ColmapView/Colmapview.github.io / getCurrentTouchEnvironment

Function getCurrentTouchEnvironment

src/hooks/useIsTouchDevice.ts:12–24  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10
11// Browser adapter for touch-mode detection. Decision logic lives in touchDevicePolicy.
12function 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
26function subscribeToTouchMediaChanges(onChange: () => void): () => void {
27 const mediaQueries = TOUCH_CAPABILITY_MEDIA_QUERIES.map((query) =>

Callers 2

detectTouchDeviceFunction · 0.85
getTouchCapabilitiesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected