blob: a8b730a6529694d021eeca89a94ba50dd79cda8e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
const extension = require('extensionizer')
const KEYS_TO_SYNC = ['KeyringController', 'PreferencesController']
module.exports = class ExtensionStore {
async fetch() {
return new Promise((resolve) => {
extension.storage.sync.get(KEYS_TO_SYNC, data => resolve(data))
})
}
async sync(state) {
const dataToSync = KEYS_TO_SYNC.reduce((result, key) => {
result[key] = state.data[key]
return result
}, {})
return new Promise((resolve) => {
extension.storage.sync.set(dataToSync, () => resolve())
})
}
}
|