forked from sheepzh/time-tracker-4-browser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase-database.ts
More file actions
35 lines (29 loc) · 738 Bytes
/
base-database.ts
File metadata and controls
35 lines (29 loc) · 738 Bytes
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
/**
* Copyright (c) 2021 Hengyang Zhang
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
import StoragePromise from "./storage-promise"
export default abstract class BaseDatabase {
storage: StoragePromise
constructor(storageArea?: chrome.storage.StorageArea) {
this.storage = new StoragePromise(storageArea)
}
/**
* @since 0.2.2
* @param key key
* @param val data
* @returns
*/
protected setByKey(key: string, val: any): Promise<void> {
return this.storage.put(key, val)
}
/**
* Import data
*
* @since 0.2.5
* @param data backup data
*/
abstract importData(data: any): Promise<void>
}