ChemPal Documentation - v0.0.13-beta.5
    Preparing search index...

    Function isMac

    • Detects whether the current platform is macOS. Used to expand the mod token and to select the mac branch of a platform-aware KeyBinding. Falls back to navigator.platform for broad compatibility; the newer userAgentData API is preferred when available.

      Returns boolean

      true on macOS, false otherwise.

      isMac(); // true on macOS
      
      export function isMac(): boolean {
      const uaData = (navigator as Navigator & { userAgentData?: { platform?: string } }).userAgentData;
      if (uaData?.platform) return /mac/i.test(uaData.platform);
      return /mac/i.test(navigator.platform);
      }