-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSyncStorage.ts
More file actions
63 lines (56 loc) · 1.25 KB
/
SyncStorage.ts
File metadata and controls
63 lines (56 loc) · 1.25 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Interface to persist values to a synchronous storage mechanism.
*/
export interface SyncStorage {
/**
* Gets a value from storage for the given key.
*
* @param key - The key under which the value is stored.
*
* @returns The stored value parsed from JSON, or undefined if not set.
*/
get<T>(key: string): T | undefined;
/**
* Sets a value in storage for the given key.
*
* @param key - The key under which to store the value.
* @param value - The value to store.
*
* @returns Nothing.
*/
set(key: string, value: unknown): void;
/**
* Removes a value from storage for the given key.
*
* @param key - The key of the value to remove.
*
* @returns Nothing.
*/
remove(key: string): void;
/**
* Removes all values from storage.
*
* @returns Nothing.
*/
clear(): void;
/**
* Get the name of the key at a given index.
*
* @param index - The index number to get the key name for.
*
* @returns The name of the key at the index.
*/
key(index: number): string | undefined;
/**
* Finds a list of all keys in storage.
*
* @returns The list of keys in storage.
*/
keys(): string[];
/**
* Get the number of items in storage.
*
* @returns The storage item count.
*/
size(): number;
}