aboutsummaryrefslogtreecommitdiff
path: root/src/actions/operation.js
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-10-07 12:21:09 +0900
committerGitHub <noreply@github.com>2017-10-07 12:21:09 +0900
commitd995ab0030522f380d165f309ffc72b582366ddb (patch)
tree69a096e9a8610ae8966af05e91355efdd27ea811 /src/actions/operation.js
parent482206f6c90985011b197623854b8bfbc26ee54c (diff)
parent9fb7bf96be786acfbad97f7c76bc423a401dd657 (diff)
Merge pull request #19 from ueokande/content-and-background-redux-completely
Refactor: full redux on content and background
Diffstat (limited to 'src/actions/operation.js')
-rw-r--r--src/actions/operation.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/actions/operation.js b/src/actions/operation.js
index 5b7f127..295fd4f 100644
--- a/src/actions/operation.js
+++ b/src/actions/operation.js
@@ -1,8 +1,14 @@
-import operations from '../operations';
-import messages from '../content/messages';
-import * as consoleActions from './console';
-import * as tabs from '../background/tabs';
-import * as zooms from '../background/zooms';
+import operations from 'shared/operations';
+import messages from 'content/messages';
+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) {
@@ -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,