aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/dialogTitle.ts
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-04-23 01:59:21 +0200
committerLibravatar GitHub <noreply@github.com>2022-04-22 23:59:21 +0000
commitd02644f7c41150709795e57bfd40351b4da35a7b (patch)
tree2403fb76bd5fae1703f8b55172ffce9e0a5d2bce /src/webview/dialogTitle.ts
parentComplete tray icons redesign for all platforms (#28) (diff)
downloadferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.gz
ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.zst
ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.zip
Preload safe debug shim (#29)
In https://github.com/ferdium/ferdium-app/pull/23 we removed usages of the debug package due to an electron bug. This patch aims to restore some debug functionality by introducing a shim. The shim detect whether if it is being introduced in a preload script where the electron but would be triggered, and falls back to a simple replacement for debug. However, in the main and renderer processes, where a preload script is not being used, we still get full debug functionality. In this way, a module can be used both in a preload script and outside of it, while still preserving debug functionality whenever possible. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/webview/dialogTitle.ts')
-rw-r--r--src/webview/dialogTitle.ts5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/webview/dialogTitle.ts b/src/webview/dialogTitle.ts
index a5bcb4c41..12e007e26 100644
--- a/src/webview/dialogTitle.ts
+++ b/src/webview/dialogTitle.ts
@@ -1,7 +1,6 @@
1import { ipcRenderer } from 'electron'; 1import { ipcRenderer } from 'electron';
2 2
3// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed 3const debug = require('../preload-safe-debug')('Ferdium:Plugin:DialogTitleHandler');
4// const debug = require('debug')('Ferdium:Plugin:DialogTitleHandler');
5 4
6export class DialogTitleHandler { 5export class DialogTitleHandler {
7 titleCache: { title: string }; 6 titleCache: { title: string };
@@ -26,7 +25,7 @@ export class DialogTitleHandler {
26 return; 25 return;
27 } 26 }
28 27
29 console.log('Sending active dialog title to host %s', newTitle); 28 debug('Sending active dialog title to host %s', newTitle);
30 ipcRenderer.sendToHost('active-dialog-title', newTitle); 29 ipcRenderer.sendToHost('active-dialog-title', newTitle);
31 30
32 this.titleCache.title = newTitle; 31 this.titleCache.title = newTitle;