Skip to content

Commit

Permalink
feat(webnowplaying): use events from wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
rxri authored Aug 31, 2023
1 parent 4151d4c commit b29e9c2
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Extensions/webnowplaying.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
class WNPReduxWebSocket {
_ws = null;
cache = new Map();
playerCache = null;
reconnectCount = 0;
updateInterval = null;
communicationRevision = null;
Expand All @@ -45,12 +44,8 @@ class WNPReduxWebSocket {
constructor() {
this.init();

setInterval(() => {
if (objectsAreEqual(Spicetify.Player.data, playerCache)) return;

playerCache = Spicetify.Player.data;
this.updateSpicetifyInfo(playerCache);
}, 100);
Spicetify.Player.addEventListener("songchange", this.updateSpicetifyInfo.bind(this));
Spicetify.Player.addEventListener("onplaypause", this.updateSpicetifyInfo.bind(this));
}

updateSpicetifyInfo(data) {
Expand Down

0 comments on commit b29e9c2

Please sign in to comment.