get-system.ts 275 B

12345678910111213
  1. // get the system os
  2. // according to UA
  3. export default function getSystem() {
  4. const ua = navigator.userAgent;
  5. if (ua.includes("Mac OS X")) return "macos";
  6. if (/win64|win32/i.test(ua)) return "windows";
  7. if (/linux/i.test(ua)) return "linux";
  8. return "unknown";
  9. }