|
|
|
@ -1,17 +1,16 @@ |
|
|
|
|
import DefaultSettings from './default'; |
|
|
|
|
import * as settingsValues from './values'; |
|
|
|
|
|
|
|
|
|
const loadRaw = () => { |
|
|
|
|
return browser.storage.local.get('settings').then(({ settings }) => { |
|
|
|
|
const loadRaw = async() => { |
|
|
|
|
let { settings } = await browser.storage.local.get('settings'); |
|
|
|
|
if (!settings) { |
|
|
|
|
return DefaultSettings; |
|
|
|
|
} |
|
|
|
|
return Object.assign({}, DefaultSettings, settings); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const loadValue = () => { |
|
|
|
|
return loadRaw().then((settings) => { |
|
|
|
|
const loadValue = async() => { |
|
|
|
|
let settings = await loadRaw(); |
|
|
|
|
let value = JSON.parse(DefaultSettings.json); |
|
|
|
|
if (settings.source === 'json') { |
|
|
|
|
value = settingsValues.valueFromJson(settings.json); |
|
|
|
@ -24,7 +23,6 @@ const loadValue = () => { |
|
|
|
|
return Object.assign({}, |
|
|
|
|
settingsValues.valueFromJson(DefaultSettings.json), |
|
|
|
|
value); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const save = (settings) => { |
|
|
|
|