beginnings of refactor
This commit is contained in:
parent
ac8f338d75
commit
3b5da6124f
63 changed files with 1697 additions and 2656 deletions
38
src/render/preload.ts
Normal file
38
src/render/preload.ts
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
// All of the Node.js APIs are available in the preload process.
|
||||
// It has the same sandbox as a Chrome extension.
|
||||
import { ipcRenderer } from "electron";
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
ipcRenderer: typeof ipcRenderer;
|
||||
}
|
||||
}
|
||||
|
||||
window.ipcRenderer = ipcRenderer;
|
||||
|
||||
process.once("loaded", () => {
|
||||
|
||||
window.addEventListener("message", event => {
|
||||
|
||||
// do something with custom event
|
||||
const message = event.data;
|
||||
|
||||
if (message.endpoint === "update-menu-bar") {
|
||||
ipcRenderer.send("update-menu-bar", message.content);
|
||||
}
|
||||
|
||||
if (message.endpoint === "update-recorder") {
|
||||
ipcRenderer.send("update-recorder", message.content);
|
||||
}
|
||||
|
||||
if (message.endpoint === "client-message") {
|
||||
ipcRenderer.send("client-message", message.content);
|
||||
}
|
||||
|
||||
if (message.endpoint === "logout") {
|
||||
ipcRenderer.send("logout", message.content);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
Loading…
Reference in a new issue