electron-better-ipc icon indicating copy to clipboard operation
electron-better-ipc copied to clipboard

BetterIpcRenderer on method only gets called once

Open MasterGordon opened this issue 4 years ago • 6 comments
trafficstars

As the title says the on method of electron-better-ipcs ipcRenderer only gets called once and the original on get called every time a message is sent.

// Renderer
ipcRenderer.on("channel", console.log)

// Main
ipcMain.sendToRenderers("channel", "test")
ipcMain.sendToRenderers("channel", "test")

This example only logs once with the better ipc one and twice with the vanilla version

MasterGordon avatar Oct 21 '21 16:10 MasterGordon

Can you confirm you're on version 2.0.1? Because a similar issue was fixed in 2.0.1: https://github.com/sindresorhus/electron-better-ipc/commit/fdda864e00358bb3141440c0c30f86aa73ef3723

sindresorhus avatar Oct 21 '21 16:10 sindresorhus

Yes I am running on version 2.0.1 If I downgrade to 2.0.0 it doesn't even get called once

MasterGordon avatar Oct 21 '21 17:10 MasterGordon

// @t13m In case you have any idea what might cause this.

sindresorhus avatar Oct 21 '21 17:10 sindresorhus

Have no idea yet, but I'll try to dig in a little bit, will update later when i find something

t13m avatar Oct 29 '21 03:10 t13m

@MasterGordon Hi, I tried in electron fiddle with v13.1.7, and no luck to reproduce this problem, the message correctly shows twice.

t13m avatar Oct 29 '21 04:10 t13m

@t13m I will try to create a repo for reproduction.

MasterGordon avatar Oct 29 '21 04:10 MasterGordon