mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-28 16:09:17 +00:00
14 lines
385 B
TypeScript
14 lines
385 B
TypeScript
export type Platform = "macos" | "windows" | "linux" | "unknown";
|
|
|
|
export function getPlatform(): Platform {
|
|
const ua = navigator.userAgent.toLowerCase();
|
|
if (ua.includes("mac")) return "macos";
|
|
if (ua.includes("win")) return "windows";
|
|
if (ua.includes("linux")) return "linux";
|
|
return "unknown";
|
|
}
|
|
|
|
export function isMacOS(): boolean {
|
|
return getPlatform() === "macos";
|
|
}
|