iOS porting: Main screen and compositor

This commit is contained in:
James Babcock committed 2026-09-05 22:59:37 -07:00
1 parent 61b3bf8b7c
commit 99793a37a7
24 files changed
+1124 -70

No files matched your search

+28
View File
@@ -0,0 +1,28 @@
import { ApplicationSettings } from '@nativescript/core'
// Main-isolate settings for the initial iOS port. Worker synchronization will
// be added when worker-hosted apps are enabled on iOS.
const listeners = new Set<(key: string) => void>()
function changed(key: string): void {
setTimeout(() => { for (const listener of [...listeners]) listener(key) }, 0)
}
export function getStringSetting(key: string, fallback: string): string {
return ApplicationSettings.getString(key, fallback)
}
export function setStringSetting(key: string, value: string): void {
if (getStringSetting(key, '') === value && ApplicationSettings.hasKey(key)) return
ApplicationSettings.setString(key, value)
changed(key)
}
export function getBooleanSetting(key: string, fallback: boolean): boolean {
return ApplicationSettings.getBoolean(key, fallback)
}
export function setBooleanSetting(key: string, value: boolean): void {
if (getBooleanSetting(key, false) === value && ApplicationSettings.hasKey(key)) return
ApplicationSettings.setBoolean(key, value)
changed(key)
}
export function onSettingsStoreChanged(listener: (key: string) => void): () => void {
listeners.add(listener)
return () => { listeners.delete(listener) }
}