aboutsummaryrefslogtreecommitdiff
path: root/src/shared/settings/storage.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2019-04-30 14:00:07 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2019-05-02 11:14:19 +0900
commitc60d0e7392fc708e961614d6b756a045de74f458 (patch)
tree0b9a5fce1879e38a92d5dbb2915779aee0ad22d6 /src/shared/settings/storage.js
parent257162e5b6b4993e1dff0d705ffa6f0d809033eb (diff)
Rename .js/.jsx to .ts/.tsx
Diffstat (limited to 'src/shared/settings/storage.js')
-rw-r--r--src/shared/settings/storage.js32
1 files changed, 0 insertions, 32 deletions
diff --git a/src/shared/settings/storage.js b/src/shared/settings/storage.js
deleted file mode 100644
index 5dce3b0..0000000
--- a/src/shared/settings/storage.js
+++ /dev/null
@@ -1,32 +0,0 @@
-import DefaultSettings from './default';
-import * as settingsValues from './values';
-
-const loadRaw = async() => {
- let { settings } = await browser.storage.local.get('settings');
- if (!settings) {
- return DefaultSettings;
- }
- return { ...DefaultSettings, ...settings };
-};
-
-const loadValue = async() => {
- let settings = await loadRaw();
- let value = JSON.parse(DefaultSettings.json);
- if (settings.source === 'json') {
- value = settingsValues.valueFromJson(settings.json);
- } else if (settings.source === 'form') {
- value = settingsValues.valueFromForm(settings.form);
- }
- if (!value.properties) {
- value.properties = {};
- }
- return { ...settingsValues.valueFromJson(DefaultSettings.json), ...value };
-};
-
-const save = (settings) => {
- return browser.storage.local.set({
- settings,
- });
-};
-
-export { loadRaw, loadValue, save };