blob: 4555a2826e7da62347d891b4f8ed6f3d969b893c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
var Storage = {
async safeOp(op, type, keys) {
try {
return await browser.storage[type][op](keys);
} catch (e) {
if (type === "sync") {
debug("Sync disabled? Falling back to local storage (%s %o)", op, keys);
} else {
error(e);
throw e;
}
}
return await browser.storage.local[op](keys);
},
async get(type, keys) {
return await this.safeOp("get", type, keys);
},
async set(type, keys) {
return await this.safeOp("set", type, keys);
}
}
|