Sign in

Class: SessionStorage

window.sessionStorage-backed implementation of IStorage.

Data persists for the lifetime of the current browser tab.

Implements

Constructors

Constructor

new SessionStorage(): SessionStorage

Returns

SessionStorage

Methods

getItem()

getItem(key: string): Promise<string | null>

Retrieves the value associated with the given key.

Parameters

ParameterTypeDescription
keystringThe unique identifier for the stored item.

Returns

Promise<string | null>

The stored value as a string, or null if the key does not exist.


removeItem()

removeItem(key: string): Promise<void>

Removes the item associated with the specified key from storage.

Parameters

ParameterTypeDescription
keystringThe unique identifier of the item to remove.

Returns

Promise<void>


setItem()

setItem(key: string, value: string): Promise<void>

Stores a key-value pair in the storage.

Parameters

ParameterTypeDescription
keystringThe unique identifier for the item.
valuestringThe string value to store.

Returns

Promise<void>

© 2024 MonoCloud. All rights reserved.