Skip to content

Latest commit

 

History

History
34 lines (22 loc) · 839 Bytes

File metadata and controls

34 lines (22 loc) · 839 Bytes
id detectPlatform
title detectPlatform

Function: detectPlatform()

function detectPlatform(): "mac" | "windows" | "linux";

Defined in: constants.ts:31

Detects the current platform based on browser navigator properties.

Used internally to resolve platform-adaptive modifiers like 'Mod' (Command on Mac, Control elsewhere) and for platform-specific hotkey formatting.

Returns

"mac" | "windows" | "linux"

The detected platform: 'mac', 'windows', or 'linux'

Remarks

Defaults to 'linux' in SSR environments where navigator is undefined

Example

const platform = detectPlatform() // 'mac' | 'windows' | 'linux'
const modifier = resolveModifier('Mod', platform) // 'Meta' on Mac, 'Control' elsewhere