blob: a5bcb4c4184fd6e8e7103a5b34189af095f47911 (
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
34
|
import { ipcRenderer } from 'electron';
// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed
// 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;
}
console.log('Sending active dialog title to host %s', newTitle);
ipcRenderer.sendToHost('active-dialog-title', newTitle);
this.titleCache.title = newTitle;
}
}
|