From 98f990fcdd498913a18b6a4ea5e37f36aa1513bc Mon Sep 17 00:00:00 2001 From: Araxeus <78568641+Araxeus@users.noreply.github.com> Date: Mon, 3 Jan 2022 17:21:13 +0200 Subject: [PATCH] dont send callback on playPause() if still handling data from new song fix notifications showing thumbnail of last song --- providers/song-info.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/providers/song-info.js b/providers/song-info.js index 330e0d7c..c4028355 100644 --- a/providers/song-info.js +++ b/providers/song-info.js @@ -86,10 +86,14 @@ const registerCallback = (callback) => { callbacks.push(callback); }; +let handlingData = false; + const registerProvider = (win) => { // This will be called when the song-info-front finds a new request with song data ipcMain.on("video-src-changed", async (_, responseText) => { + handlingData = true; await handleData(responseText, win); + handlingData = false; callbacks.forEach((c) => { c(songInfo); }); @@ -97,6 +101,7 @@ const registerProvider = (win) => { ipcMain.on("playPaused", (_, { isPaused, elapsedSeconds }) => { songInfo.isPaused = isPaused; songInfo.elapsedSeconds = elapsedSeconds; + if (handlingData) return; callbacks.forEach((c) => { c(songInfo); });