aboutsummaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-01 12:25:49 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-01 12:25:49 +0900
commit1b2554adee528da1078ad39694a3f8264c639821 (patch)
tree0fcacdad33a51cf7611af77e601443eb827c2498 /src/pages
parent709fa95aa383b75e88fb12512f772ea55d757b06 (diff)
parent8c9051076f7782b898ab2f848b9afe4a694c3065 (diff)
Merge branch 'settings-validation'
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/settings.js29
1 files changed, 11 insertions, 18 deletions
diff --git a/src/pages/settings.js b/src/pages/settings.js
index 6e00ed3..9bad967 100644
--- a/src/pages/settings.js
+++ b/src/pages/settings.js
@@ -1,22 +1,15 @@
import './settings.scss';
-import messages from '../content/messages';
+import SettingComponent from '../components/setting';
+import settingReducer from '../reducers/setting';
+import * as store from '../store';
-document.addEventListener('DOMContentLoaded', () => {
- let form = document.getElementById('vimvixen-settings-form');
- form.addEventListener('submit', (e) => {
- e.preventDefault();
- browser.storage.local.set({
- settings: {
- json: e.target.elements['plain-json'].value
- }
- }).then(() => {
- return browser.runtime.sendMessage({
- type: messages.SETTINGS_RELOAD
- });
- });
- });
+const settingStore = store.createStore(settingReducer);
+let settingComponent = null;
+
+settingStore.subscribe(() => {
+ settingComponent.update();
+});
- browser.storage.local.get('settings').then((value) => {
- form.elements['plain-json'].value = value.settings.json;
- }, console.error);
+document.addEventListener('DOMContentLoaded', () => {
+ settingComponent = new SettingComponent(document.body, settingStore);
});