From 49ca4b64e338431581414b365ee17f0be68d023f Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Fri, 13 Mar 2020 00:28:34 +0100 Subject: [PATCH] forwarding logs to UI --- src/ext/uw-bg.js | 1 + src/ext/uw-ui.js | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/src/ext/uw-bg.js b/src/ext/uw-bg.js index 76f47eb..0440aa5 100644 --- a/src/ext/uw-bg.js +++ b/src/ext/uw-bg.js @@ -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) { diff --git a/src/ext/uw-ui.js b/src/ext/uw-ui.js index d3607bc..f3b22b3 100644 --- a/src/ext/uw-ui.js +++ b/src/ext/uw-ui.js @@ -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