Skip to content

Commit

Permalink
Try/Catch on message receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
BlythMeister committed Oct 6, 2024
1 parent b4b9af2 commit 2cbe726
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions src/366x366/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,28 @@ if (settings.hasSettings()) {
}

msgq.addEventListener("message", (messageKey, message) => {
var key = messageKey.split(":")[0];
if (key === "weather") {
weather.processWeatherData(message);
} else if (key === "settingChange") {
settings.settingUpdate(message);
} else if (key === "settingsChunk") {
for (let index = 0; index < message.length; index++) {
const element = message[index];
settings.settingUpdate(element);
try
{
var key = messageKey.split(":")[0];
if (key === "weather") {
weather.processWeatherData(message);
} else if (key === "settingChange") {
settings.settingUpdate(message);
} else if (key === "settingsChunk") {
for (let index = 0; index < message.length; index++) {
const element = message[index];
settings.settingUpdate(element);
}
} else if (key === "settingsComplete") {
startingEl.style.display = "none";
settings.saveSettings();
} else {
console.error(`Unknown key: ${key}`);
}
} else if (key === "settingsComplete") {
startingEl.style.display = "none";
settings.saveSettings();
}
catch (e) {
console.error(e);
}
});

let prereleaseEl = document.getElementById("pr");
Expand Down

0 comments on commit 2cbe726

Please sign in to comment.