From b4c6b2b08bc762164afd12ff489218e8564526fb Mon Sep 17 00:00:00 2001 From: ManishMadan2882 Date: Thu, 10 Apr 2025 01:44:49 +0530 Subject: [PATCH] (feat:utils) getOS, isTouchDevice --- frontend/src/utils/browserUtils.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 frontend/src/utils/browserUtils.ts diff --git a/frontend/src/utils/browserUtils.ts b/frontend/src/utils/browserUtils.ts new file mode 100644 index 00000000..a9f54952 --- /dev/null +++ b/frontend/src/utils/browserUtils.ts @@ -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; +}