Skip to content

Commit

Permalink
fix: remove properly usb when closing window
Browse files Browse the repository at this point in the history
  • Loading branch information
javierguzman committed Aug 9, 2023
1 parent c822ad7 commit ef9942c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ app.on("activate", async () => {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) {
addUSBListeners();
createWindow();
}
});
Expand Down
1 change: 1 addition & 0 deletions src/main/setup/configureUSB.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export const addUSBListeners = () => {
export const removeUSBListeners = () => {
webusb.removeEventListener("connect", onUSBConnect);
webusb.removeEventListener("disconnect", onUSBDisconnect);
ipcMain.removeHandler("usb-devices");
};

export const getDevices = () => {
Expand Down

0 comments on commit ef9942c

Please # to comment.