A widget for saving and getting name value pairs. Uses browser localStorage by default but you can override the remove, get and store functions, or derive a new class, to save to a different data store.
Methods
-
<static> callbacker(key)
-
Provides a closure that can be passed in to other STX UI components for storage or removal.
Parameters:
Name Type Description key
string The key for the closure
Returns:
A closure of form fc(value, stx)
- Type
- fc
Example
// This provides the ThemeManager with a mechanism for saving its data, under the key "themes" STX.ThemeManager.themesToMenu(node, node, stx, STX.StorageManager.callbacker("themes"));
-
<static> get(key [, cb])
-
Get the value for a given key from storage
Parameters:
Name Type Argument Description key
string The key
cb
function <optional>
Optionally receive the result in a callback. Required for asynchronous interfaces.
- Since:
-
- 2015-03-01 Added optional callback
Returns:
The data in JSON format ( sample: "[{"list 1":["IBM","GE","INTC"]},{"list 2":["G","T","W","K"]}]")
- Type
- object
-
<static> remove(key)
-
Remove the key from storage
Parameters:
Name Type Description key
string The key
-
<static> store(key, value)
-
Save the key value pair in storage
Parameters:
Name Type Description key
string The key
value
object The value in Json format ( sample: "[{"list 1":["IBM","GE","INTC"]},{"list 2":["G","T","W","K"]}]")