Merge pull request #294 from lbryio/teardown-focused-listeners

Teardown old window event listeners and don't blow up when window isn't focused
This commit is contained in:
Jeremy Kauffman 2017-06-27 12:55:23 -04:00 committed by GitHub
commit 6aad233f66

View file

@ -75,7 +75,10 @@ document.addEventListener("click", event => {
const application = remote.app; const application = remote.app;
const dock = application.dock; 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 // Clear the badge when the window is focused
win.on("focus", () => { win.on("focus", () => {