aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/dialogTitle.ts
diff options
context:
space:
mode:
authorLibravatar Vijay A <vraravam@users.noreply.github.com>2021-10-27 07:25:26 +0530
committerLibravatar Vijay A <vraravam@users.noreply.github.com>2021-10-27 07:25:26 +0530
commit477bdd76a7405ff10a5cfabdec00ee9ae02f2698 (patch)
treebfa8cfb70e6852b9f535ccfd9b05712269a70dc1 /src/webview/dialogTitle.ts
parentBumped up ferdi beta version to '5.6.3-beta.2' (diff)
parent5.6.3-nightly.44 [skip ci] (diff)
downloadferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.gz
ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.tar.zst
ferdium-app-477bdd76a7405ff10a5cfabdec00ee9ae02f2698.zip
Merge branch 'nightly' into release
Diffstat (limited to 'src/webview/dialogTitle.ts')
-rw-r--r--src/webview/dialogTitle.ts33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/webview/dialogTitle.ts b/src/webview/dialogTitle.ts
new file mode 100644
index 000000000..f9a1aac6f
--- /dev/null
+++ b/src/webview/dialogTitle.ts
@@ -0,0 +1,33 @@
1import { ipcRenderer } from 'electron';
2
3const debug = require('debug')('Ferdi:Plugin:DialogTitleHandler');
4
5export class DialogTitleHandler {
6 titleCache: { title: string };
7
8 constructor() {
9 this.titleCache = {
10 title: '',
11 };
12 }
13
14 safeGetTitle(title: string | undefined | null) {
15 if (!title) {
16 return '';
17 }
18
19 return title;
20 }
21
22 setDialogTitle(title: string | undefined | null) {
23 const newTitle = this.safeGetTitle(title);
24 if (this.titleCache.title === newTitle) {
25 return;
26 }
27
28 debug('Sending active dialog title to host %s', newTitle);
29 ipcRenderer.sendToHost('active-dialog-title', newTitle);
30
31 this.titleCache.title = newTitle;
32 }
33}