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
setItemDescription
Stores a value associated with a key and synchronizes it with the remote storage.
Signature
setItem(key: string, value: any): voidParameters
key(string): The key under which the value is stored.value(any): The value to store.
Example Usage
localStorage.setItem("username", "JohnDoe");getItem
getItemDescription
Retrieves a stored value by its key.
Signature
Parameters
key(string): The key to retrieve the stored value.
Returns
T | null: The stored value ornullif the key does not exist.
Example Usage
removeItem
removeItemDescription
Removes a value from storage and synchronizes the removal with the remote storage.
Signature
Parameters
key(string): The key to remove.
Example Usage
clear
clearDescription
Clears all stored data and synchronizes the removal with the remote storage.
Signature
Example Usage
keys
keysDescription
Retrieves an array of all stored keys.
Signature
Returns
string[]: An array of stored keys.
Example Usage
toJSON
toJSONDescription
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