-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
module.js
37 lines (30 loc) · 871 Bytes
/
module.js
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
'use strict';
export class Options {
static keyNotification = 'enable-notification';
// system, light, dark
static keyColor = 'color-scheme';
constructor(storage) {
this.storage = storage;
}
async getNotification() {
const opt = await this.storage.get({ [Options.keyNotification]: false });
return opt[Options.keyNotification];
}
async setNotification(enable) {
return await this.storage.set({ [Options.keyNotification]: enable });
}
async getColorScheme() {
const opt = await this.storage.get({ [Options.keyColor]: 'system' });
return opt[Options.keyColor];
}
async setColorScheme(scheme) {
return await this.storage.set({ [Options.keyColor]: scheme });
}
// Mainly for testing
async clear() {
return await this.storage.clear(null);
}
async dump() {
return await this.storage.get(null);
}
}