Class DataStorageManager
Index
Accessors
Methods
Accessors
store
- get store(): JSONRecord
Returns a copy of all currently monitored keys.
Returns JSONRecord
Methods
fetch
- fetch<T>(keys, monitor?): Promise<T>
Fetches a list of key-value pairs from data storage.
Type Parameters
- T extends JSONRecord
The expected key-value types to be returned.
Parameters
- keys: (keyof T)[]
A list of keys to fetch values for.
Optional
monitor: booleanAdds keys to local cache and request the server to update client when changes are made to speed up subsequent lookups.
Returns Promise<T>
An object containing all current values for each key requested.
- T extends JSONRecord
- fetch<T>(key, monitor?): Promise<T>
Fetches a single key-value pair from data storage.
Type Parameters
- T extends JSONSerializable
The expected value type to be returned.
Parameters
- key: string
The key to fetch a value for.
Optional
monitor: booleanAdds key to local cache and request the server to update client when changes are made to speed up subsequent lookups.
Returns Promise<T>
The current value for this key.
- T extends JSONSerializable
fetchItemNameGroups
fetchLocationNameGroups
notify
- notify<T>(keys, callback): Promise<T>
Add a list of keys to be monitored for changes and fire a callback when changes are detected.
Type Parameters
- T extends JSONRecord
Parameters
- keys: (keyof T)[]
A list of keys to fetch and watch for changes.
- callback: DataChangeCallback
A callback to fire whenever one of these keys change.
Returns Promise<T>
An object containing all current values for each key requested.
prepare
- prepare<T>(key, _default): IntermediateDataOperation<T>
Create a new transaction for setting a data storage key by returning an IntermediateDataOperation. To perform certain operations, just chain additional methods until finished, then call
prepare()
.Type Parameters
- T extends JSONSerializable
Parameters
- key: string
The key to manipulate.
- _default: T
The default value to be used if key does not exist.
Returns IntermediateDataOperation<T>
Manages communication between the data storage API and notifies subscribers of changes to storage updates.