mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 09:03:15 +00:00
(feat:utils) getOS, isTouchDevice
This commit is contained in:
10
frontend/src/utils/browserUtils.ts
Normal file
10
frontend/src/utils/browserUtils.ts
Normal file
@@ -0,0 +1,10 @@
|
||||
export function getOS() {
|
||||
const userAgent = window.navigator.userAgent;
|
||||
if (userAgent.indexOf('Mac') !== -1) return 'mac';
|
||||
if (userAgent.indexOf('Win') !== -1) return 'win';
|
||||
return 'linux';
|
||||
}
|
||||
|
||||
export function isTouchDevice() {
|
||||
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
|
||||
}
|
||||
Reference in New Issue
Block a user