working communication between renderer and main process

This commit is contained in:
talksik
2022-05-28 01:35:42 -05:00
parent 0e0a8629e0
commit 7236cbf680
2 changed files with 43 additions and 42 deletions
+4 -3
View File
@@ -43,9 +43,10 @@ const createWindow = (): void => {
// This method will be called when Electron has finished // This method will be called when Electron has finished
// initialization and is ready to create browser windows. // initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs. // Some APIs can only be used after this event occurs.
app.on('ready', createWindow); app
.whenReady()
app.whenReady().then(() => { .then(createWindow)
.then(() => {
// dynamically changing the window bounds // dynamically changing the window bounds
ipcMain.on(Channels.RESIZE_WINDOW, (event, req: DimensionChangeRequest) => { ipcMain.on(Channels.RESIZE_WINDOW, (event, req: DimensionChangeRequest) => {
if (req.setAlwaysOnTop) { if (req.setAlwaysOnTop) {
@@ -63,7 +63,7 @@ export function ElectronProvider({ children }: { children: React.ReactNode }) {
setIsWindowFocused(false); setIsWindowFocused(false);
// TODO: testing mode... uncomment both instructions below // TODO: testing mode... uncomment both instructions below
setDesktopMode('overlayOnly'); // setDesktopMode('overlayOnly');
}); });
window.electronAPI.on(Channels.ON_WINDOW_FOCUS, () => { window.electronAPI.on(Channels.ON_WINDOW_FOCUS, () => {