diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-09 20:35:15 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-09 20:35:15 +0900 |
commit | e6c5aea0748a108fc2c8eccc233130d08a957fb8 (patch) | |
tree | 2a134d5753757fdafec1e4e747720d257010f322 /src/content | |
parent | 6a2bfc51baf22bcf66153076120d48d894a3967d (diff) |
more broadcast message
Diffstat (limited to 'src/content')
-rw-r--r-- | src/content/index.js | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/content/index.js b/src/content/index.js index a2a864d..bf90363 100644 --- a/src/content/index.js +++ b/src/content/index.js @@ -1,7 +1,6 @@ import * as scrolls from './scrolls'; import * as histories from './histories'; import * as actions from '../shared/actions'; -import * as messages from '../shared/messages'; import ConsoleFrame from '../console/console-frame'; import Follow from './follow'; @@ -84,28 +83,27 @@ const doCompletion = (line) => { vvConsole.showError(err.message); }); } + return Promise.resolve(); }; -messages.receive(window, (message) => { - switch (message.type) { +browser.runtime.onMessage.addListener((action) => { + switch (action.type) { case 'vimvixen.command.blur': if (!vvConsole.isErrorShown()) { vvConsole.hide(); } - break; + return Promise.resolve(); case 'vimvixen.command.enter': - browser.runtime.sendMessage({ + return browser.runtime.sendMessage({ type: 'event.cmd.enter', - text: message.value + text: action.value }).catch((err) => { console.error("Vim Vixen:", err); vvConsole.showError(err.message); }); - break; case 'vimvixen.command.change': - doCompletion(message.value); - break; + return doCompletion(action.value); default: - return; + return Promise.resolve(); } }); |