LocalStorageHelper
The LocalStorageHelper class offers functionality to work with localStorage object.
import { LocalStorageHelper } from '@archibald/client';
set
Set a value in the local storage.
import { LocalStorageHelper } from '@archibald/client';
LocalStorageHelper.set(PARAMETERS);
Parameters
| Name | Type | Optional | Description |
|---|---|---|---|
| key | string | A key to be used to store a value in the local storage. | |
| value | string | ✔️ | A value that should be stored in the local storage. If the value is not provided then the key will be taken as the value. |
get
Get a value from the local storage. Will return false if there is no value for the given key.
import { LocalStorageHelper } from '@archibald/client';
const value = LocalStorageHelper.get(PARAMETERS);
Parameters
| Name | Type | Description |
|---|---|---|
| key | string | A key to be used to get a value from the local storage. |
delete
Delete a value from the local storage.
import { LocalStorageHelper } from '@archibald/client';
LocalStorageHelper.delete(PARAMETERS);
Parameters
| Name | Type | Description |
|---|---|---|
| key | string | A key to be used to delete a value from the local storage. |
clear
Clear the local storage.
import { LocalStorageHelper } from '@archibald/client';
LocalStorageHelper.clear();