DatabaseStorage class
Storage wrapper for IndexedDB storage in browsers: https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API
Constructors
Database |
Methods
close |
Closes the connection to IndexedDB database when all pending transactions complete. |
contains |
Checks whether there is an object under the search key in the object store |
delete |
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. |
get |
Retrieves item from IndexedDB instance. |
get |
Get all the keys from the storage object as an iterable array of strings. |
open() | Opens IndexedDB instance. |
remove |
Removes item from IndexedDB under given key |
set |
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>