forwarding logs to UI

This commit is contained in:
Tamius Han 2020-03-13 00:28:34 +01:00
parent 06a2f67759
commit 49ca4b64e3
2 changed files with 6 additions and 0 deletions

View File

@ -64,6 +64,7 @@ class UWServer {
this.comms.subscribe('show-logger', async () => await this.initUiAndShowLogger());
this.comms.subscribe('init-vue', async () => await this.initUi());
this.comms.subscribe('uwui-vue-initialized', () => this.uiLoggerInitialized = true);
this.comms.subscribe('emit-logs', () => {}); // we don't need to do anything, this gets forwarded to UI content script as is
if(BrowserDetect.firefox) {

View File

@ -22,6 +22,7 @@ class UwUi {
this.commsHandlers = {
'show-logger': [() => this.showLogger()],
'hide-logger': [() => this.hideLogger()],
'emit-logs' : [(message) => {console.log("emit logs received in uwui!", message); this.addLogs(message)}]
}
}
@ -211,6 +212,10 @@ class UwUi {
this.vuexStore.dispatch('uw-hide-logger');
}
}
addLogs(message) {
this.logger.appendLog(JSON.parse(message.payload));
}
}
// leave a mark, so this script won't get executed more than once on a given page