aboutsummaryrefslogtreecommitdiff
path: root/src/content
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2017-09-09 16:56:31 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2017-09-09 20:03:06 +0900
commit3d35db9fc1f1af20867bfc235e962667f8615b6e (patch)
treecf9017f09321d05270c3ba9787061d03473effac /src/content
parente15de17598b222f16c2eb9c4aa2e47610bc61ed9 (diff)
send message to content instead of response
Diffstat (limited to 'src/content')
-rw-r--r--src/content/index.js19
1 files changed, 4 insertions, 15 deletions
diff --git a/src/content/index.js b/src/content/index.js
index 27dc581..d5cca94 100644
--- a/src/content/index.js
+++ b/src/content/index.js
@@ -7,7 +7,8 @@ import Follow from './follow';
let vvConsole = new ConsoleFrame(window);
-const doAction = (action) => {
+
+browser.runtime.onMessage.addListener((action) => {
switch (action.type) {
case actions.CMD_OPEN:
vvConsole.showCommand('');
@@ -51,19 +52,8 @@ const doAction = (action) => {
histories.next(window);
break;
}
-}
-
-const handleResponse = (response) => {
- if (!response) {
- return;
- }
-
- switch(response.type) {
- case 'response.action':
- doAction(response.action);
- break;
- }
-};
+ return Promise.resolve();
+});
window.addEventListener("keypress", (e) => {
if (e.target instanceof HTMLInputElement) {
@@ -77,7 +67,6 @@ window.addEventListener("keypress", (e) => {
}
browser.runtime.sendMessage(request)
- .then(handleResponse)
.catch((err) => {
console.error("Vim Vixen:", err);
vvConsole.showError(err.message);