diff --git a/lib/libimhex/source/helpers/utils.cpp b/lib/libimhex/source/helpers/utils.cpp index a7c7d9be1..1e3771669 100644 --- a/lib/libimhex/source/helpers/utils.cpp +++ b/lib/libimhex/source/helpers/utils.cpp @@ -1002,17 +1002,21 @@ namespace hex { } #elif defined(OS_WEB) EM_ASM({ - const t = UTF8ToString($0); - const m = UTF8ToString($1); + try { + const t = UTF8ToString($0); + const m = UTF8ToString($1); - if (Notification.permission === "granted") { - new Notification(t, { body: m }); - } else if (Notification.permission !== "denied") { - Notification.requestPermission().then(function(p) { - if (p === "granted") { - new Notification(t, { body: m }); - } - }); + if (Notification.permission === "granted") { + new Notification(t, { body: m }); + } else if (Notification.permission !== "denied") { + Notification.requestPermission().then(function(p) { + if (p === "granted") { + new Notification(t, { body: m }); + } + }); + } + } catch (e) { + console.error(e); } }, title.c_str(), message.c_str()); #endif diff --git a/plugins/builtin/source/content/events.cpp b/plugins/builtin/source/content/events.cpp index 61e2d9bc6..225425d87 100644 --- a/plugins/builtin/source/content/events.cpp +++ b/plugins/builtin/source/content/events.cpp @@ -432,9 +432,10 @@ namespace hex::plugin::builtin { if (!taskFinishedNotificationEnabled) return; - - if (!ImHexApi::System::isMainWindowFocused() && !task.isBackgroundTask()) - hex::showToastMessage("ImHex", fmt::format("hex.builtin.os_toast_message.task_finished"_lang, Lang(task.getUnlocalizedName()))); + #if !defined(OS_WEB) + if (!ImHexApi::System::isMainWindowFocused() && !task.isBackgroundTask()) + hex::showToastMessage("ImHex", fmt::format("hex.builtin.os_toast_message.task_finished"_lang, Lang(task.getUnlocalizedName()))); + #endif }); }