mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2026-09-30 19:48:11 +08:00
Replace globals with editor environment (#3656)
Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
@@ -25,18 +25,17 @@ export function browserVersion(): string {
|
||||
return `${match[0]} ${match[1]}`;
|
||||
}
|
||||
|
||||
export type OperatingSystem = "Windows" | "Mac" | "Linux" | "Unknown";
|
||||
export type OperatingSystem = "Windows" | "Mac" | "Linux";
|
||||
|
||||
export function operatingSystem(): OperatingSystem {
|
||||
const osTable: Record<string, OperatingSystem> = {
|
||||
Windows: "Windows",
|
||||
Mac: "Mac",
|
||||
Linux: "Linux",
|
||||
Unknown: "Unknown",
|
||||
};
|
||||
|
||||
const userAgentOS = Object.keys(osTable).find((key) => window.navigator.userAgent.includes(key));
|
||||
return osTable[userAgentOS || "Unknown"];
|
||||
return osTable[userAgentOS || "Windows"];
|
||||
}
|
||||
|
||||
export function isDesktop(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user