DatabaseStorage class

Storage wrapper for IndexedDB storage in browsers: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API

Constructors

DatabaseStorage()

Methods

closeConnection()

Closes the connection to IndexedDB database when all pending transactions complete.

containsKey(string)

Checks whether there is an object under the search key in the object store

deleteDatabase()

Deletes the MSAL database. The database is deleted rather than cleared to make it possible for client applications to downgrade to a previous MSAL version without worrying about forward compatibility issues with IndexedDB database versions.

getItem(string)

Retrieves item from IndexedDB instance.

getKeys()

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

open()

Opens IndexedDB instance.

removeItem(string)

Removes item from IndexedDB under given key

setItem(string, T)

Adds item to IndexedDB under given key

Constructor Details

DatabaseStorage()

new DatabaseStorage()

Method Details

closeConnection()

Closes the connection to IndexedDB database when all pending transactions complete.

function closeConnection()

containsKey(string)

Checks whether there is an object under the search key in the object store

function containsKey(key: string): Promise<boolean>

Parameters

key

string

Returns

Promise<boolean>

deleteDatabase()

Deletes the MSAL database. The database is deleted rather than cleared to make it possible for client applications to downgrade to a previous MSAL version without worrying about forward compatibility issues with IndexedDB database versions.

function deleteDatabase(): Promise<boolean>

Returns

Promise<boolean>

getItem(string)

Retrieves item from IndexedDB instance.

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

Parameters

key

string

Returns

Promise<T | null>

getKeys()

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

function getKeys(): Promise<string[]>

Returns

Promise<string[]>

open()

Opens IndexedDB instance.

function open(): Promise<void>

Returns

Promise<void>

removeItem(string)

Removes item from IndexedDB under given key

function removeItem(key: string): Promise<void>

Parameters

key

string

Returns

Promise<void>

setItem(string, T)

Adds item to IndexedDB under given key

function setItem(key: string, payload: T): Promise<void>

Parameters

key

string

payload

T

Returns

Promise<void>