aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-16 20:26:13 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-16 21:08:18 +0900
commitc7a3dd16e666b5f844bc98f19e58a3fe9967b5a4 (patch)
tree58bc3b854a93a98dfc6f0e65f684f52c95bb8a77 /src
parent83cb277ba2af2bc2f87ace1d97fa582a7043bcd5 (diff)
message constants
Diffstat (limited to 'src')
-rw-r--r--src/actions/operation.js3
-rw-r--r--src/background/index.js2
-rw-r--r--src/console/console.js2
-rw-r--r--src/content/index.js5
-rw-r--r--src/messages/index.js3
5 files changed, 10 insertions, 5 deletions
diff --git a/src/actions/operation.js b/src/actions/operation.js
index 2009818..e589b89 100644
--- a/src/actions/operation.js
+++ b/src/actions/operation.js
@@ -1,4 +1,5 @@
import operations from '../operations';
+import messages from '../messages';
import * as consoleActions from './console';
import * as tabs from '../background/tabs';
import * as zooms from '../background/zooms';
@@ -34,7 +35,7 @@ export function exec(operation, tab) {
return consoleActions.showCommand('buffer ');
default:
return browser.tabs.sendMessage(tab.id, {
- type: 'require.content.operation',
+ type: messages.CONTENT_OPERATION,
operation
});
}
diff --git a/src/background/index.js b/src/background/index.js
index d2cfeb4..f329a9c 100644
--- a/src/background/index.js
+++ b/src/background/index.js
@@ -32,7 +32,7 @@ backgroundStore.subscribe(() => {
browser.tabs.query({ active: true, currentWindow: true }).then((tabs) => {
if (tabs.length > 0) {
return browser.tabs.sendMessage(tabs[0].id, {
- type: 'state.changed',
+ type: messages.STATE_UPDATE,
state: backgroundStore.getState()
});
}
diff --git a/src/console/console.js b/src/console/console.js
index 7e9bffa..d1547b8 100644
--- a/src/console/console.js
+++ b/src/console/console.js
@@ -171,7 +171,7 @@ const update = (state) => {
}
browser.runtime.onMessage.addListener((action) => {
- if (action.type === 'state.changed') {
+ if (action.type === messages.STATE_UPDATE) {
return update(action.state.console);
}
});
diff --git a/src/content/index.js b/src/content/index.js
index d81e83e..43d632e 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -5,6 +5,7 @@ import * as scrolls from '../content/scrolls';
import * as histories from '../content/histories';
import Follow from '../content/follow';
import operations from '../operations';
+import messages from '../messages';
consoleFrames.initialize(window.document);
@@ -51,9 +52,9 @@ const update = (state) => {
browser.runtime.onMessage.addListener((action) => {
switch (action.type) {
- case 'state.changed':
+ case messages.STATE_UPDATE:
return update(action.state);
- case 'require.content.operation':
+ case messages.CONTENT_OPERATION:
execOperation(action.operation);
return Promise.resolve();
default:
diff --git a/src/messages/index.js b/src/messages/index.js
index 078ecaf..ad036a8 100644
--- a/src/messages/index.js
+++ b/src/messages/index.js
@@ -1,4 +1,7 @@
export default {
+ STATE_UPDATE: 'state.update',
+ CONTENT_OPERATION: 'content.operation',
+
CONSOLE_BLURRED: 'console.blured',
CONSOLE_ENTERED: 'console.entered',
CONSOLE_CHANGEED: 'console.changed'