broadcast an action

This commit is contained in:
Shin'ya Ueoka 2017-09-09 20:16:51 +09:00
parent 3d35db9fc1
commit 0eed357a5e
4 changed files with 15 additions and 11 deletions

View file

@ -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) {

View file

@ -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();
});