app.js
app.whenReady().then(() => {
const win = new BrowserWindow({
width: 800,
height: 600
)}
win.loadFile('index.html')
win.on("resized", () => {
console.log("Window resized")
win.webContents.send("resize", "window resized")
})
}
script.js
require('electron').ipcRenderer.on('resize', (event, message) => {
alert("Received!")
})
of course I have included it in index.html <script type="text/javascript" src="script.js"></script>
Everything looks fine to me but when I run the application and resize the window I see in the console "Window resized" but the message is never received by ipcRenderer.on() function, what am I missing?
I'm running on MacBook m1.