Storage Object
Storage Object Documentation
Description
The Storage
object provides an in-memory key-value storage system that synchronizes with a remote service using the Roboqo
RPC interface. It supports both local and session storage types and provides methods to manipulate stored data efficiently. You can access storage via localStorage and sessionStorage global objects.
Methods
setItem
setItem
Description
Stores a value associated with a key and synchronizes it with the remote storage.
Signature
Parameters
key
(string
): The key under which the value is stored.value
(any
): The value to store.
Example Usage
getItem
getItem
Description
Retrieves a stored value by its key.
Signature
Parameters
key
(string
): The key to retrieve the stored value.
Returns
T | null
: The stored value ornull
if the key does not exist.
Example Usage
removeItem
removeItem
Description
Removes a value from storage and synchronizes the removal with the remote storage.
Signature
Parameters
key
(string
): The key to remove.
Example Usage
clear
clear
Description
Clears all stored data and synchronizes the removal with the remote storage.
Signature
Example Usage
keys
keys
Description
Retrieves an array of all stored keys.
Signature
Returns
string[]
: An array of stored keys.
Example Usage
toJSON
toJSON
Description
Converts the stored data into a JSON object.
Signature
Returns
Record<string, any>
: An object representation of the stored data.
Example Usage
Example Usage
Last updated