aboutsummaryrefslogtreecommitdiff
path: root/src/pages/console.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-06 23:55:52 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-10-06 23:55:52 +0900
commit4cb17031d11d76275de51e31218fb87359e7d826 (patch)
tree626a976e303458daef90a5a5fac34a5185bc275e /src/pages/console.js
parent10ad62e60698c5d53ffcf58ae6abd182f7d3fc9c (diff)
[wip] remove STATE_UPDATE
Diffstat (limited to 'src/pages/console.js')
-rw-r--r--src/pages/console.js13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/pages/console.js b/src/pages/console.js
index 4d78826..4d3dd3f 100644
--- a/src/pages/console.js
+++ b/src/pages/console.js
@@ -4,7 +4,7 @@ import CompletionComponent from 'components/completion';
import ConsoleComponent from 'components/console';
import reducers from 'reducers';
import { createStore } from 'store';
-import * as completionActions from 'actions/completion';
+import * as consoleActions from 'actions/console';
const store = createStore(reducers);
let completionComponent = null;
@@ -20,6 +20,7 @@ window.addEventListener('load', () => {
store.subscribe(() => {
completionComponent.update();
+ consoleComponent.update();
let state = store.getState().completion;
@@ -36,8 +37,12 @@ store.subscribe(() => {
});
browser.runtime.onMessage.addListener((action) => {
- if (action.type === messages.STATE_UPDATE) {
- let state = action.state.console;
- consoleComponent.update(state);
+ switch (action.type) {
+ case messages.CONSOLE_SHOW_COMMAND:
+ return store.dispatch(consoleActions.showCommand(action.command));
+ case messages.CONSOLE_SHOW_ERROR:
+ return store.dispatch(consoleActions.showError(action.command));
+ case messages.CONSOLE_HIDE:
+ return store.dispatch(consoleActions.hide(action.command));
}
});