aboutsummaryrefslogtreecommitdiff
path: root/plugins/base/frontend/src/main/components/utils/os.ts
blob: 3005245c32052b703386442fd74ff139ae1425c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
export enum OsKind{
    WINDOWS,
    MACOS,
    LINUX,
    OTHER
}

export const detectOsKind = (): OsKind => {
    const userAgent = navigator.userAgent
    if(userAgent.includes("Mac")) return OsKind.MACOS
    else if (userAgent.includes("Win")) return OsKind.WINDOWS
    else if (userAgent.includes("Linux")) return OsKind.LINUX
    else return OsKind.OTHER
}