MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / getOS

Function getOS

docs/src/components/platformcontext.tsx:16–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14export const PlatformContext = createContext<PlatformContextProps | undefined>(undefined);
15
16function getOS(): Platform {
17 const platform = window.navigator.platform;
18 const macosPlatforms = ["Macintosh", "MacIntel", "MacPPC", "Mac68K"];
19 const windowsPlatforms = ["Win32", "Win64", "Windows", "WinCE"];
20 const iosPlatforms = ["iPhone", "iPad", "iPod"];
21
22 if (macosPlatforms.includes(platform) || iosPlatforms.includes(platform)) {
23 return "mac";
24 } else if (windowsPlatforms.includes(platform)) {
25 return "windows";
26 } else {
27 return "linux";
28 }
29}
30
31const PlatformProviderInternal = ({ children }: { children: ReactNode }) => {
32 const [platform, setPlatform] = useState<Platform>(getOS());

Callers 1

PlatformProviderInternalFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected