Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

System APIs Overview

The perry/system module provides access to platform-native system features: preferences, secure storage, notifications, URL opening, and dark mode detection.

import { openURL, isDarkMode, preferencesSet, preferencesGet } from "perry/system";

Available APIs

FunctionDescriptionPlatforms
openURL(url)Open URL in default browser/appAll
isDarkMode()Check system dark modeAll
preferencesSet(key, value)Store a preferenceAll
preferencesGet(key)Read a preferenceAll
keychainSet(key, value)Secure storage writeAll
keychainGet(key)Secure storage readAll
sendNotification(title, body)Local notificationAll
clipboardGet()Read clipboardAll
clipboardSet(text)Write clipboardAll

Quick Example

import { isDarkMode, preferencesGet, preferencesSet, openURL } from "perry/system";

// Detect dark mode
if (isDarkMode()) {
  console.log("Dark mode is active");
}

// Store user preferences
preferencesSet("theme", "dark");
const theme = preferencesGet("theme");

// Open a URL
openURL("https://example.com");

Next Steps