@windy/store
Represents a key-value store with methods for getting, setting, and observing values. The store maintains the integrity of the parameters and checks the validity of the input.
Used store keys are defined as DataSpecifications
interface.
Check out complete list of store properties.
Used for storing major parameters and user settings.
It also supports observing changes to the values and retrieving allowed values for each key.
Use methods get
to read value from store, set
to change value in the store and on
to observe change of the value. Some of the items respond to method getAllowed
to return array of allowed values.
Method set
returns true
if provided value was valid and was actually changed.
Store is instance of class Evented.
Example
var overlay = store.get('overlay');
// 'wind' ... actually used overlay
var allowedOverlays = store.getAllowed('overlay');
// ['wind', 'rain', ... ] ... list of allowed values
store.set('overlay', 'rain');
// true ... Overlay was changed to rain
store.on('overlay', ovr => {
// Called when value was changed
});
Table of contents
Variables
Variables
default
• Const
default: Store