Skip to content

Commit

Permalink
Handle force quit of the application gracefully
Browse files Browse the repository at this point in the history
This prevents an uncaught exception following the window destructure.
  • Loading branch information
TomasHubelbauer committed Jun 11, 2024
1 parent c132bde commit de11183
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ electron.app.on('ready', async () => {
// Render current lyrics line on a fast interval for smooth updates
setInterval(
async () => {
// Handle the window no longer existing after Ctrl+C while testing
if (window.isDestroyed()) {
process.exit(0);
}

if (!lyrics || ('error' in lyrics) || state !== 'playing') {
// Get rid of the lingering shadows/opacity (for the most part) - see the readme
window.reload();
Expand Down

0 comments on commit de11183

Please sign in to comment.