-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathnotificationRenderer.js
40 lines (30 loc) · 1.12 KB
/
notificationRenderer.js
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
35
36
37
38
39
40
const { ipcRenderer } = require("electron");
ipcRenderer.on("add-window-name-to-app", (event, windowName) => {
updateWindowMessage(`Window Selected: ${windowName}`);
});
ipcRenderer.on("stop-recording", () => {
// Stop the media recorder
updateWindowMessage("Processing...");
});
ipcRenderer.on("push-question-to-windows", (event, questionText) => {
updateWindowMessage(`${questionText} ... thinking...`);
});
ipcRenderer.on("start-recording", async () => {
updateWindowMessage("Recording in progress...");
});
ipcRenderer.on("update-notificationWindow-text", (event, textInput) => {
updateWindowMessage(textInput);
});
document.getElementById("closeBtn").addEventListener("click", () => {
ipcRenderer.send("close-notification-window");
});
function updateWindowMessage(message) {
const analysisContainer = document.getElementById("analysis");
let messageDiv = analysisContainer.querySelector(".window-message");
if (!messageDiv) {
messageDiv = document.createElement("div");
messageDiv.className = "window-message";
analysisContainer.appendChild(messageDiv);
}
messageDiv.textContent = message;
}