mirror of
https://github.com/gitlabhq/gitlabhq.git
synced 2025-08-01 15:53:04 +00:00
14 lines
411 B
JavaScript
14 lines
411 B
JavaScript
/**
|
|
* Detects if the current device has touch capability
|
|
*
|
|
* @returns {boolean} True if device has touch capability, false otherwise
|
|
*/
|
|
export function hasTouchCapability() {
|
|
return Boolean(
|
|
'ontouchstart' in window ||
|
|
navigator.maxTouchPoints > 0 ||
|
|
navigator.msMaxTouchPoints > 0 ||
|
|
(typeof window.DocumentTouch !== 'undefined' && document instanceof window.DocumentTouch),
|
|
);
|
|
}
|