aboutsummaryrefslogtreecommitdiff
path: root/src/pages
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-04 21:30:57 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-04 21:30:57 +0900
commit6594841b1d1f082107bdb1489f02d3c99cff8ffa (patch)
tree594f2eb56b43143e5dba30317a9e8a3cbf578051 /src/pages
parent482206f6c90985011b197623854b8bfbc26ee54c (diff)
use createStore short-hand method
Diffstat (limited to 'src/pages')
-rw-r--r--src/pages/console.js16
-rw-r--r--src/pages/settings.js8
2 files changed, 12 insertions, 12 deletions
diff --git a/src/pages/console.js b/src/pages/console.js
index 2cbea25..4ce9e47 100644
--- a/src/pages/console.js
+++ b/src/pages/console.js
@@ -3,26 +3,26 @@ import messages from '../content/messages';
import CompletionComponent from '../components/completion';
import ConsoleComponent from '../components/console';
import completionReducer from '../reducers/completion';
-import * as store from '../store';
+import { createStore } from '../store';
import * as completionActions from '../actions/completion';
-const completionStore = store.createStore(completionReducer);
+const store = createStore(completionReducer);
let completionComponent = null;
let consoleComponent = null;
let prevState = {};
window.addEventListener('load', () => {
let wrapper = document.querySelector('#vimvixen-console-completion');
- completionComponent = new CompletionComponent(wrapper, completionStore);
+ completionComponent = new CompletionComponent(wrapper, store);
- // TODO use root root store instead of completionStore
- consoleComponent = new ConsoleComponent(document.body, completionStore);
+ // TODO use root root store instead of store
+ consoleComponent = new ConsoleComponent(document.body, store);
});
-completionStore.subscribe(() => {
+store.subscribe(() => {
completionComponent.update();
- let state = completionStore.getState();
+ let state = store.getState();
if (state.groupSelection >= 0) {
let item = state.groups[state.groupSelection].items[state.itemSelection];
@@ -40,6 +40,6 @@ browser.runtime.onMessage.addListener((action) => {
if (action.type === messages.STATE_UPDATE) {
let state = action.state.console;
consoleComponent.update(state);
- completionStore.dispatch(completionActions.setItems(state.completions));
+ store.dispatch(completionActions.setItems(state.completions));
}
});
diff --git a/src/pages/settings.js b/src/pages/settings.js
index 9bad967..076d23d 100644
--- a/src/pages/settings.js
+++ b/src/pages/settings.js
@@ -1,15 +1,15 @@
import './settings.scss';
import SettingComponent from '../components/setting';
import settingReducer from '../reducers/setting';
-import * as store from '../store';
+import { createStore } from '../store';
-const settingStore = store.createStore(settingReducer);
+const store = createStore(settingReducer);
let settingComponent = null;
-settingStore.subscribe(() => {
+store.subscribe(() => {
settingComponent.update();
});
document.addEventListener('DOMContentLoaded', () => {
- settingComponent = new SettingComponent(document.body, settingStore);
+ settingComponent = new SettingComponent(document.body, store);
});