Class DataStorageManager
Accessors
store
-
Returns a copy of all currently monitored keys.
Returns JSONRecord
Methods
fetch
-
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.
Optionalmonitor: 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
-
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.
Optionalmonitor: 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
-
Returns item name groups for this package from data storage API.
Parameters
- game: string
The game name to look up item name groups for.
Returns Promise<Record<string, string[]>>
- game: string
fetchLocationNameGroups
-
Returns location name groups for this package from the data storage API.
Parameters
- game: string
The game name to look up location name groups for.
Returns Promise<Record<string, string[]>>
- game: string
notify
-
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
-
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.