Merge pull request 'fix-events' (#2) from fix-events into main

Reviewed-on: #2
main
lambda 2 years ago
commit 8618588a75

@ -2,6 +2,24 @@
All notable changes to this project will be documented in this file. See [conventional commits](https://www.conventionalcommits.org/) for commit guidelines.
- - -
## 0.3.3 - 2024-03-16
#### Bug Fixes
- fix events data passing into functions - (ef15edf) - lambda
- - -
## 0.3.2 - 2024-01-27
#### Bug Fixes
- fix error with arg destruction - (407e69c) - lambda
- - -
## 0.3.1 - 2024-01-27
#### Bug Fixes
- fix passing ws message - (b710623) - lambda
- - -
## 0.3.0 - 2024-01-20
#### Features
- use message-processor library - (dcfc6b3) - lambda

@ -11,6 +11,9 @@ start:
build:
docker build . -t $(IMAGE_NAME):$(GIT_TAG)
build-experimental:
docker build . -t $(IMAGE_NAME):experimental
bump-latest:
docker tag $(IMAGE_NAME):$(GIT_TAG) $(IMAGE_NAME):latest
@ -19,3 +22,6 @@ push-current: login
push-latest: login
docker push $(IMAGE_NAME):latest
push-experimental: login
docker push $(IMAGE_NAME):experimental

@ -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 }) => {
@ -161,7 +163,7 @@ const changeTitles = ({ artist, title }) => {
}
};
const metadataChange = ({ data }) => {
const metadataChange = (data) => {
changeTitles(data);
};
@ -173,7 +175,7 @@ const liveEnded = () => {
logoDot.classList.remove("live");
};
const setState = ({ data }) => {
const setState = (data) => {
const { lastPlayed, isOnline } = data;
if (lastPlayed) changeTitles(lastPlayed);
if (isOnline) liveStarted();

@ -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();

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