소스 검색

[ADDED] MacOS detect

Eric R 1 년 전
부모
커밋
3bfcdf9c41
1개의 변경된 파일12개의 추가작업 그리고 0개의 파일을 삭제
  1. 12 0
      app/utils.ts

+ 12 - 0
app/utils.ts

@@ -173,3 +173,15 @@ export function autoGrowTextArea(dom: HTMLTextAreaElement) {
 export function getCSSVar(varName: string) {
   return getComputedStyle(document.body).getPropertyValue(varName).trim();
 }
+
+/**
+ * Detects if the Operation system is MacOS
+ */
+export function isMacOS(): boolean {
+    if (window !== 'undefined') {
+        let userAgent = window?.navigator?.userAgent
+        if (userAgent.indexOf('Mac') != -1) return true
+    }
+
+    return false
+}