API / @aionbuilders/nabu/extend

detectPlatform

Function Stability: stable

Detect the platform whose conventions Mod and the displayed shortcuts follow: Cmd on macOS and iOS, Ctrl everywhere else.

Related guide: Commands and keymap →

Signature

TypeScript
import { detectPlatform } from '@aionbuilders/nabu/extend';
TypeScript
function detectPlatform(): Platform

Returns

Platform

'mac' on macOS / iOS (Cmd is the main modifier), 'other' everywhere else (and server-side).

Source: src/lib/utils/keys.js:34