Skip to content

@modoki/engine / index / selectDefaultBackend

Function: selectDefaultBackend()

selectDefaultBackend(): PrefsBackend

Pick the persistence backend for the current platform: native (Capacitor) → Preferences; a working localStorage → LocalStorage; else in-memory (SSR / locked-down browser / tests). The app passes the result to PlayerPrefs.init({ backend }); init() itself defaults to in-memory so headless and unit-test runs stay deterministic unless a backend is chosen explicitly.

Returns

PrefsBackend

Built with Modoki.