[wip] remove STATE_UPDATE

This commit is contained in:
Shin'ya Ueoka 2017-10-06 23:55:52 +09:00
parent 10ad62e606
commit 4cb17031d1
6 changed files with 31 additions and 32 deletions

View file

@ -55,17 +55,12 @@ const execOperation = (operation) => {
}
};
const update = (state) => {
if (!state.console.commandShown) {
window.focus();
consoleFrames.blur(window.document);
}
};
browser.runtime.onMessage.addListener((action) => {
switch (action.type) {
case messages.STATE_UPDATE:
return update(action.state);
case messages.CONSOLE_HIDE:
window.focus();
consoleFrames.blur(window.document);
return Promise.resolve();
case messages.CONTENT_OPERATION:
execOperation(action.operation);
return Promise.resolve();

View file

@ -1,10 +1,12 @@
export default {
STATE_UPDATE: 'state.update',
CONTENT_OPERATION: 'content.operation',
CONSOLE_BLURRED: 'console.blured',
CONSOLE_ENTERED: 'console.entered',
CONSOLE_QUERY_COMPLETIONS: 'console.query.completions',
CONSOLE_SHOW_COMMAND: 'console.show.command',
CONSOLE_SHOW_ERROR: 'console.show.error',
CONSOLE_HIDE: 'console.hide',
KEYDOWN: 'keydown',