Teardown old window event listeners and don't blow up when window isn't focused

at boot/reload
This commit is contained in:
6ea86b96 2017-06-27 19:54:25 +07:00
parent fabfc06703
commit 28eb490014
No known key found for this signature in database
GPG key ID: B282D183E4931E8F

View file

@ -75,7 +75,10 @@ document.addEventListener("click", event => {
const application = remote.app;
const dock = application.dock;
const win = remote.BrowserWindow.getFocusedWindow();
const win = remote.getCurrentWindow();
// Tear down previous event listeners when reload
win.removeAllListeners();
// Clear the badge when the window is focused
win.on("focus", () => {