fix: fix error with arg destruction

pull/2/head
lambda 2 years ago
parent 4699be0119
commit 407e69cab9

@ -139,7 +139,9 @@ const socketProtocol = location.protocol === "http:" ? "ws:" : "wss:";
async function connectToServer() {
const ws = new WebSocket(`${socketProtocol}//${location.host}/meta`);
ws.addEventListener("message", messageProcessor.processMessage);
ws.addEventListener("message", (event) =>
messageProcessor.processMessage(event.data),
);
}
const changeTitles = ({ artist, title }) => {

@ -20,7 +20,7 @@ const changeTitles = ({ artist, title }) => {
}
};
const metadataChange = ({ data }) => {
const metadataChange = (data) => {
changeTitles(data);
};
@ -32,7 +32,7 @@ const liveEnded = () => {
logoDot.classList.remove("live");
};
const setState = ({ data }) => {
const setState = (data) => {
const { lastPlayed, isOnline } = data;
if (lastPlayed) changeTitles(lastPlayed);
if (isOnline) liveStarted();