Skip to content

PreferencesStorage

Overview

Singleton that can save and load a Property's value to localStorage, and keep it in sync for the next runtime. Must be used with ?preferencesStorage.

NOTE: Property values are stringified, so don't try using this with something like new StringProperty( 'true' )

@author Michael Kauzmann (PhET Interactive Simulations)

Class PreferencesStorage

import { PreferencesStorage } from 'scenerystack/joist';

Constructor

new PreferencesStorage()

Instance Methods

Static Methods

register( property : TProperty<unknown>, name : string ) : TProperty<unknown>

Source Code

See the source for PreferencesStorage.ts in the joist repository.