Skip to content

Commit

Permalink
Merge pull request #18 from dacoaster/stacking_listeners
Browse files Browse the repository at this point in the history
Fix stacking listeners and bump version
  • Loading branch information
dacoaster authored Mar 9, 2023
2 parents 68d3128 + f471052 commit 55ea841
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yattie",
"version": "0.5.4",
"version": "0.5.5",
"engines": {
"npm": ">=8.0.0 <9.0.0",
"node": ">=16.0.0 <17.0.0"
Expand Down
5 changes: 5 additions & 0 deletions src/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ contextBridge.exposeInMainWorld("ipc", {
return await ipcRenderer.invoke(channel, data);
},
on: (channel, func) => {
// Remove any old listeners
ipcRenderer.removeAllListeners(channel);
// Strip event as it includes `sender` and is a security risk
ipcRenderer.on(channel, (event, ...args) => func(...args));
},
clearCache: () => {
webFrame.clearCache();
},
eventNames: () => {
return ipcRenderer.eventNames();
},
});

0 comments on commit 55ea841

Please sign in to comment.