Bypass beforeunload on window close so app quits while audio plays
This commit is contained in:
@@ -26,6 +26,15 @@ async function createWindow() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
mainWindow.on('close', (e) => {
|
||||||
|
// Bypass beforeunload (YT Music sets one while audio is playing) so the
|
||||||
|
// window actually closes when the user clicks X or chooses Quit.
|
||||||
|
if (mainWindow && !mainWindow.isDestroyed()) {
|
||||||
|
e.preventDefault();
|
||||||
|
mainWindow.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
mainWindow.on('closed', () => {
|
mainWindow.on('closed', () => {
|
||||||
mainWindow = null;
|
mainWindow = null;
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user