[js] have shm_log specifically use a section, like the server-side functions

This commit is contained in:
Shish 2024-01-13 13:25:58 +00:00
parent 9e64ffeb66
commit 11a0ba27e9

View file

@ -5,11 +5,11 @@ function shm_cookie_get(name) {
return Cookies.get(name);
}
function shm_log(...message) {
window.dispatchEvent(new CustomEvent("shm_log", {detail: {message: message}}));
function shm_log(section, ...message) {
window.dispatchEvent(new CustomEvent("shm_log", {detail: {section, message}}));
}
window.addEventListener("shm_log", function (e) {
console.log(...e.detail.message);
console.log(e.detail.section, ...e.detail.message);
});
window.addEventListener("error", function (e) {
shm_log("Window error:", e.error);