forked from authts/oidc-client-ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAsyncStorage.ts
31 lines (31 loc) · 1.39 KB
/
AsyncStorage.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* @public
*/
export interface AsyncStorage {
/** Returns the number of key/value pairs. */
readonly length: Promise<number>;
/**
* Removes all key/value pairs, if there are any.
*
* Dispatches a storage event on Window objects holding an equivalent Storage object.
*/
clear(): Promise<void>;
/** Returns the current value associated with the given key, or null if the given key does not exist. */
getItem(key: string): Promise<string | null>;
/** Returns the name of the nth key, or null if n is greater than or equal to the number of key/value pairs. */
key(index: number): Promise<string | null>;
/**
* Removes the key/value pair with the given key, if a key/value pair with the given key exists.
*
* Dispatches a storage event on Window objects holding an equivalent Storage object.
*/
removeItem(key: string): Promise<void>;
/**
* Sets the value of the pair identified by key to value, creating a new key/value pair if none existed for key previously.
*
* Throws a "QuotaExceededError" DOMException exception if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)
*
* Dispatches a storage event on Window objects holding an equivalent Storage object.
*/
setItem(key: string, value: string): Promise<void>;
}