diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 10:09:24 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-01 10:09:24 +0900 |
commit | 709fa95aa383b75e88fb12512f772ea55d757b06 (patch) | |
tree | cfec09d9c626b2f0898d59937accd73651ab2168 /src | |
parent | be5f4d12d5afc12f25b1e2732075ee416f5665bf (diff) |
clean console.js
Diffstat (limited to 'src')
-rw-r--r-- | src/components/console.js | 5 | ||||
-rw-r--r-- | src/pages/console.js | 17 |
2 files changed, 7 insertions, 15 deletions
diff --git a/src/components/console.js b/src/components/console.js index a4bdad5..9580dcf 100644 --- a/src/components/console.js +++ b/src/components/console.js @@ -14,9 +14,12 @@ export default class ConsoleComponent { input.addEventListener('blur', this.onBlur.bind(this)); input.addEventListener('keydown', this.onKeyDown.bind(this)); input.addEventListener('keyup', this.onKeyUp.bind(this)); + + this.hideCommand(); + this.hideError(); } - static onBlur() { + onBlur() { return browser.runtime.sendMessage({ type: messages.CONSOLE_BLURRED, }); diff --git a/src/pages/console.js b/src/pages/console.js index feaf725..b90a9cd 100644 --- a/src/pages/console.js +++ b/src/pages/console.js @@ -30,21 +30,10 @@ completionStore.subscribe(() => { } }); -const update = (state) => { - consoleComponent.update(state); - - completionStore.dispatch(completionActions.setItems(state.completions)); -}; - browser.runtime.onMessage.addListener((action) => { if (action.type === messages.STATE_UPDATE) { - return update(action.state.console); + let state = action.state.console; + consoleComponent.update(state); + completionStore.dispatch(completionActions.setItems(state.completions)); } }); - -window.addEventListener('load', () => { - let error = window.document.querySelector('#vimvixen-console-error'); - let command = window.document.querySelector('#vimvixen-console-command'); - error.style.display = 'none'; - command.style.display = 'none'; -}); |