Class: Preference

Preference

new Preference(key, defaultValueopt, allowedValuesopt)

This uses the localStorage to store and read from. We use a simple key:value in the localStorage but further expose the allowedValues passed. For now we do not validate those.
Parameters:
Name Type Attributes Description
key string the key we want to store
defaultValue string <optional>
if no value is set in the storage we will set this value
allowedValues Array <optional>
an array of known values that should be supported
Source:
Example
preference.newPreference('key', 'defaultValue', ['defaultValue', 'allowedValues']);

Members

newValue

setter method to set the new value for the preference
Source:

Methods

getAllowedValues() → {*}

get the known allowed values for this preference
Source:
Returns:
Type
*

getValue() → {*|string|Object|boolean|number|undefined}

get the value
Source:
Returns:
Type
* | string | Object | boolean | number | undefined