Revision 6247f163
Added by koszko about 2 years ago
| common/storage_raw.js | ||
|---|---|---|
| 26 | 26 |
|
| 27 | 27 |
async function set(key_or_object, value) |
| 28 | 28 |
{
|
| 29 |
return browser.storage.local.set(typeof key_or_object === "object" ? |
|
| 30 |
key_or_object : {[key]: value});
|
|
| 29 |
const arg = typeof key_or_object === "object" ? |
|
| 30 |
key_or_object : {[key_or_object]: value};
|
|
| 31 |
return browser.storage.local.set(arg); |
|
| 31 | 32 |
} |
| 32 | 33 |
|
| 33 | 34 |
async function set_var(name, value) |
| ... | ... | |
| 40 | 41 |
return get(TYPE_PREFIX.VAR + name); |
| 41 | 42 |
} |
| 42 | 43 |
|
| 43 |
const raw_storage = {get, set, get_var, set_var};
|
|
| 44 |
const on_changed = browser.storage.onChanged || browser.storage.local.onChanged; |
|
| 45 |
const listen = cb => on_changed.addListener(cb); |
|
| 46 |
const no_listen = cb => on_changed.removeListener(cb); |
|
| 47 |
|
|
| 48 |
const raw_storage = {get, set, get_var, set_var, listen, no_listen};
|
|
| 44 | 49 |
|
| 45 | 50 |
/* |
| 46 | 51 |
* EXPORTS_START |
Also available in: Unified diff
enable toggling of global script blocking policy\n\nThis commit also introduces `light_storage' module which is later going to replace the storage code we use right now.\nAlso included is a hack to properly display scrollbars under Mozilla (needs testing on newer Mozilla browsers).