diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-04 21:30:57 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-04 21:30:57 +0900 |
commit | 6594841b1d1f082107bdb1489f02d3c99cff8ffa (patch) | |
tree | 594f2eb56b43143e5dba30317a9e8a3cbf578051 /src/background/index.js | |
parent | 482206f6c90985011b197623854b8bfbc26ee54c (diff) |
use createStore short-hand method
Diffstat (limited to 'src/background/index.js')
-rw-r--r-- | src/background/index.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/background/index.js b/src/background/index.js index e968c82..9a1adc6 100644 --- a/src/background/index.js +++ b/src/background/index.js @@ -4,27 +4,27 @@ import BackgroundComponent from '../components/background'; import BackgroundInputComponent from '../components/background-input'; import reducers from '../reducers'; import messages from '../content/messages'; -import * as store from '../store'; +import { createStore } from '../store'; -const backgroundStore = store.createStore(reducers, (e, sender) => { +const store = createStore(reducers, (e, sender) => { console.error('Vim-Vixen:', e); if (sender) { - backgroundStore.dispatch(consoleActions.showError(e.message), sender); + store.dispatch(consoleActions.showError(e.message), sender); } }); -const backgroundComponent = new BackgroundComponent(backgroundStore); -const backgroundInputComponent = new BackgroundInputComponent(backgroundStore); -backgroundStore.subscribe((sender) => { +const backgroundComponent = new BackgroundComponent(store); +const backgroundInputComponent = new BackgroundInputComponent(store); +store.subscribe((sender) => { backgroundComponent.update(sender); backgroundInputComponent.update(sender); }); -backgroundStore.subscribe((sender) => { +store.subscribe((sender) => { if (sender) { return browser.tabs.sendMessage(sender.tab.id, { type: messages.STATE_UPDATE, - state: backgroundStore.getState() + state: store.getState() }); } }); -backgroundStore.dispatch(settingsActions.load()); +store.dispatch(settingsActions.load()); |