UI builder - Studio API
Storage
To execute Storage APIs, take a look at the examples below:
Api.page.storage.get('MyKey');
Api.page.storage.set('MyKey', value);
Api.page.storage.set({ key1: 'value1', key2: 'value2' });
Api.page.storage.remove('key');
get
Retrieves the Key from the storage
Api.page.storage.get(key:string): void;
Parameter | Type | Description |
---|---|---|
key | string | Gets the value of the key provided |
set
Sets the Key and store it to the page
Api.page.storage.set(key: string, value: any): void;
Parameter | Type | Description |
---|---|---|
key | string | Sets the value of the key provided |
value | any | The value of the key to be stored |
To set multiple key values, use:
Api.page.storage.set(object: Record<string, any>): void;
for example:
Api.page.storage.set({ key1: 'value1', key2: 'value2' });
// This will add the new key values but not ovewrite the whole object
remove
Removes a key from the Storage
Api.page.storage.remove(key: string): void;
Parameter | Type | Description |
---|---|---|
key | string | The key to be removed |
clear
Clear all storage objects from the page
Api.page.storage.clear(): void;
value
Gets all current page storage objects
Api.page.storage.value: void;
keys
Get all available keys in page storage
Api.page.storage.value: void;