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
| Function | Description | Platforms |
|---|---|---|
openURL(url) | Open URL in default browser/app | All |
isDarkMode() | Check system dark mode | All |
preferencesSet(key, value) | Store a preference | All |
preferencesGet(key) | Read a preference | All |
keychainSet(key, value) | Secure storage write | All |
keychainGet(key) | Secure storage read | All |
sendNotification(title, body) | Local notification | All |
clipboardGet() | Read clipboard | All |
clipboardSet(text) | Write clipboard | All |
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");