-
Notifications
You must be signed in to change notification settings - Fork 65
/
Storage.ts
38 lines (34 loc) · 978 Bytes
/
Storage.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
32
33
34
35
36
37
38
import { StorageKey } from '../types/storage/StorageKey'
import { StorageKeyReturnType } from '../types/storage/StorageKeyReturnType'
/**
* @internalapi
*
* The storage used in the SDK
*/
export abstract class Storage {
/**
* Returns a promise that resolves to true if the storage option is available on this platform.
*/
public static isSupported(): Promise<boolean> {
return Promise.resolve(false)
}
/**
* Gets a value from storage and returns it
*
* @param key The storage key
*/
abstract get<K extends StorageKey>(key: K): Promise<StorageKeyReturnType[K]>
/**
* Sets a value in the storage and persist it
*
* @param key The storage key
* @param value The value to be persisted
*/
abstract set<K extends StorageKey>(key: K, value: StorageKeyReturnType[K]): Promise<void>
/**
* Delete a key from storage
*
* @param key The storage key
*/
abstract delete<K extends StorageKey>(key: K): Promise<void>
}