blob: 9e8d8db373562bd5e58bb7ffc0df5e6c13acf9c0 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
// We should not rely on local storage in an extension!
// We should use this instead!
// https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/storage/local
const extension = require('extensionizer')
module.exports = class ExtensionStore {
constructor() {
this.isSupported = !!(extension.storage.local)
if (!this.isSupported) {
log.error('Storage local API not available.')
}
}
get() {
return new Promise((resolve) => {
extension.storage.local.get(null, resolve)
})
}
set(state) {
return new Promise((resolve) => {
extension.storage.local.set(state, resolve)
})
}
}
|