Skip to content

Commit b4c6b2b

Browse files
(feat:utils) getOS, isTouchDevice
1 parent 6cb4577 commit b4c6b2b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

frontend/src/utils/browserUtils.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
export function getOS() {
2+
const userAgent = window.navigator.userAgent;
3+
if (userAgent.indexOf('Mac') !== -1) return 'mac';
4+
if (userAgent.indexOf('Win') !== -1) return 'win';
5+
return 'linux';
6+
}
7+
8+
export function isTouchDevice() {
9+
return 'ontouchstart' in window || navigator.maxTouchPoints > 0;
10+
}

0 commit comments

Comments
 (0)