Edit

Share via


LocalStorage class

Constructors

LocalStorage(string, Logger, IPerformanceClient)

Methods

clear()

Removes all known MSAL keys from the cache

containsKey(string)

Returns true or false if the given key is present in the cache.

getItem(string)

Get the item from the window storage object matching the given key.

getKeys()

Get all the keys from the window storage object as an iterable array of strings.

getUserData(string)

Getter for sensitive data that may contain PII.

initialize(string)

Async initializer

removeItem(string)

Removes the item in the window storage object matching the given key.

setItem(string, string)

Sets the item in the window storage object with the given key.

setUserData(string, string, string, string)

Setter for sensitive data that may contain PII.

Constructor Details

LocalStorage(string, Logger, IPerformanceClient)

new LocalStorage(clientId: string, logger: Logger, performanceClient: IPerformanceClient)

Parameters

clientId

string

logger
Logger
performanceClient
IPerformanceClient

Method Details

clear()

Removes all known MSAL keys from the cache

function clear()

containsKey(string)

Returns true or false if the given key is present in the cache.

function containsKey(key: string): boolean

Parameters

key

string

Returns

boolean

getItem(string)

Get the item from the window storage object matching the given key.

function getItem(key: string): null | string

Parameters

key

string

Returns

null | string

getKeys()

Get all the keys from the window storage object as an iterable array of strings.

function getKeys(): string[]

Returns

string[]

getUserData(string)

Getter for sensitive data that may contain PII.

function getUserData(key: string): null | string

Parameters

key

string

Returns

null | string

initialize(string)

Async initializer

function initialize(correlationId: string): Promise<void>

Parameters

correlationId

string

Returns

Promise<void>

removeItem(string)

Removes the item in the window storage object matching the given key.

function removeItem(key: string)

Parameters

key

string

setItem(string, string)

Sets the item in the window storage object with the given key.

function setItem(key: string, value: string)

Parameters

key

string

value

string

setUserData(string, string, string, string)

Setter for sensitive data that may contain PII.

function setUserData(key: string, value: string, correlationId: string, timestamp: string): Promise<void>

Parameters

key

string

value

string

correlationId

string

timestamp

string

Returns

Promise<void>