Skip to main content

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

NameTypeOptionalDescription
keystringA key to be used to store a value in the local storage.
valuestring✔️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

NameTypeDescription
keystringA 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

NameTypeDescription
keystringA key to be used to delete a value from the local storage.

clear

Clear the local storage.

import { LocalStorageHelper } from '@archibald/client';

LocalStorageHelper.clear();