mirror of
https://github.com/t8y2/dbx.git
synced 2026-10-25 16:00:07 +00:00
18 lines
465 B
TypeScript
18 lines
465 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";
|
|
}
|
|
|
|
export function isWindows(): boolean {
|
|
return getPlatform() === "windows";
|
|
}
|