blob: 393c2499f14f5041d9883b728d7db8dc9a987ca1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
import { ipcRenderer } from 'electron';
const debug = require('debug')('Ferdium:Plugin:DialogTitleHandler');
export class DialogTitleHandler {
titleCache: { title: string };
constructor() {
this.titleCache = {
title: '',
};
}
safeGetTitle(title: string | undefined | null) {
if (!title) {
return '';
}
return title;
}
setDialogTitle(title: string | undefined | null) {
const newTitle = this.safeGetTitle(title);
if (this.titleCache.title === newTitle) {
return;
}
debug('Sending active dialog title to host %s', newTitle);
ipcRenderer.sendToHost('active-dialog-title', newTitle);
this.titleCache.title = newTitle;
}
}
|