clean console.js

jh-changes
Shin'ya Ueoka 7 years ago
parent be5f4d12d5
commit 709fa95aa3
  1. 5
      src/components/console.js
  2. 17
      src/pages/console.js

@ -14,9 +14,12 @@ export default class ConsoleComponent {
input.addEventListener('blur', this.onBlur.bind(this)); input.addEventListener('blur', this.onBlur.bind(this));
input.addEventListener('keydown', this.onKeyDown.bind(this)); input.addEventListener('keydown', this.onKeyDown.bind(this));
input.addEventListener('keyup', this.onKeyUp.bind(this)); input.addEventListener('keyup', this.onKeyUp.bind(this));
this.hideCommand();
this.hideError();
} }
static onBlur() { onBlur() {
return browser.runtime.sendMessage({ return browser.runtime.sendMessage({
type: messages.CONSOLE_BLURRED, type: messages.CONSOLE_BLURRED,
}); });

@ -30,21 +30,10 @@ completionStore.subscribe(() => {
} }
}); });
const update = (state) => {
consoleComponent.update(state);
completionStore.dispatch(completionActions.setItems(state.completions));
};
browser.runtime.onMessage.addListener((action) => { browser.runtime.onMessage.addListener((action) => {
if (action.type === messages.STATE_UPDATE) { 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';
});