diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-09 20:16:51 +0900 |
---|---|---|
committer | Shin'ya Ueoka <ueokande@i-beam.org> | 2017-09-09 20:16:51 +0900 |
commit | 0eed357a5e1ceb3061d88ef99a612bb8c4526fa7 (patch) | |
tree | 5b27df7f5c71aab984c3175ac5fd6063801c10f4 /src/console | |
parent | 3d35db9fc1f1af20867bfc235e962667f8615b6e (diff) |
broadcast an action
Diffstat (limited to 'src/console')
-rw-r--r-- | src/console/console-frame.js | 2 | ||||
-rw-r--r-- | src/console/console.js | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/console/console-frame.js b/src/console/console-frame.js index e6bf3f5..a590da9 100644 --- a/src/console/console-frame.js +++ b/src/console/console-frame.js @@ -22,8 +22,8 @@ export default class ConsoleFrame { type: 'vimvixen.console.show.command', text: text }; - messages.send(this.element.contentWindow, message); this.errorShown = false; + return browser.runtime.sendMessage(message); } showError(text) { diff --git a/src/console/console.js b/src/console/console.js index c32eca0..ae05001 100644 --- a/src/console/console.js +++ b/src/console/console.js @@ -195,9 +195,6 @@ const selectCompletion = (target) => { messages.receive(window, (message) => { switch (message.type) { - case 'vimvixen.console.show.command': - showCommand(message.text); - break; case 'vimvixen.console.show.error': showError(message.text); break; @@ -206,3 +203,11 @@ messages.receive(window, (message) => { break; } }); + +browser.runtime.onMessage.addListener((action) => { + switch (action.type) { + case 'vimvixen.console.show.command': + return showCommand(action.text); + } + return Promise.resolve(); +}); |