mirror of
https://github.com/goodpuppies/petplay.git
synced 2026-10-29 04:01:31 +01:00
classes/settings.ts holds a typed schema (grabboxOutline, controllerLaser, keyboardLocale, wristClock) persisted to $XDG_CONFIG_HOME/petplay/settings.json (PETPLAY_SETTINGS_PATH overrides) with atomic writes and unknown keys kept. The webxr actor loads it on init and answers GETSETTINGS / SETSETTING. Agent: Claude Code 2.1.296; model claude-opus-5-5; thread 941be8c7-aca1-4664-b284-7cc0eed69e21
19 lines
604 B
TypeScript
19 lines
604 B
TypeScript
import { getSetting, setSetting, subscribeSettings, useSetting } from "../settings.ts";
|
|
|
|
export function setControllerLaserEnabled(enabled: boolean): void {
|
|
setSetting("controllerLaser", enabled);
|
|
}
|
|
|
|
export function getControllerLaserEnabled(): boolean {
|
|
return getSetting("controllerLaser");
|
|
}
|
|
|
|
/** Fires on any settings change; callers re-read `getControllerLaserEnabled`. */
|
|
export function subscribeControllerLaserEnabled(listener: () => void): () => void {
|
|
return subscribeSettings(listener);
|
|
}
|
|
|
|
export function useControllerLaserEnabled(): boolean {
|
|
return useSetting("controllerLaser");
|
|
}
|