When a button is clicked I want the event listener to be removed.
function clickMe(f,i){
ipcRenderer.send('click', i)
ipcRenderer.on(`message`, function (en, message) {
document.getElementById(`status${i}`).innerHTML = message[1];
//ipcRenderer.removeAllListeners('message') <- I don't want all listeners to be removed
});
}
As shown in the code above, removeAllListeners works, however, I do not want all listeners to be removed. I believe I can use removeListener('message', function) but if I try to put removeListener('message', startMe()) I get thrown an error of undefined. How would I go abouts doing this?