diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-06 23:55:52 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-10-06 23:55:52 +0900 |
commit | 4cb17031d11d76275de51e31218fb87359e7d826 (patch) | |
tree | 626a976e303458daef90a5a5fac34a5185bc275e /src/actions | |
parent | 10ad62e60698c5d53ffcf58ae6abd182f7d3fc9c (diff) |
[wip] remove STATE_UPDATE
Diffstat (limited to 'src/actions')
-rw-r--r-- | src/actions/operation.js | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/actions/operation.js b/src/actions/operation.js index 97bcf45..295fd4f 100644 --- a/src/actions/operation.js +++ b/src/actions/operation.js @@ -1,9 +1,15 @@ import operations from 'shared/operations'; import messages from 'content/messages'; -import * as consoleActions from './console'; import * as tabs from 'background/tabs'; import * as zooms from 'background/zooms'; +const sendConsoleShowCommand = (tab, command) => { + return browser.tabs.sendMessage(tab.id, { + type: messages.CONSOLE_SHOW_COMMAND, + command, + }); +}; + const exec = (operation, tab) => { switch (operation.type) { case operations.TAB_CLOSE: @@ -23,21 +29,21 @@ const exec = (operation, tab) => { case operations.ZOOM_NEUTRAL: return zooms.neutral(); case operations.COMMAND_SHOW: - return consoleActions.showCommand(''); + return sendConsoleShowCommand(tab, ''); case operations.COMMAND_SHOW_OPEN: if (operation.alter) { // alter url - return consoleActions.showCommand('open ' + tab.url); + return sendConsoleShowCommand(tab, 'open ' + tab.url); } - return consoleActions.showCommand('open '); + return sendConsoleShowCommand(tab, 'open '); case operations.COMMAND_SHOW_TABOPEN: if (operation.alter) { // alter url - return consoleActions.showCommand('tabopen ' + tab.url); + return sendConsoleShowCommand(tab, 'tabopen ' + tab.url); } - return consoleActions.showCommand('tabopen '); + return sendConsoleShowCommand(tab, 'tabopen '); case operations.COMMAND_SHOW_BUFFER: - return consoleActions.showCommand('buffer '); + return sendConsoleShowCommand(tab, 'buffer '); default: return browser.tabs.sendMessage(tab.id, { type: messages.CONTENT_OPERATION, |