aboutsummaryrefslogtreecommitdiff
path: root/src/app
diff options
context:
space:
mode:
author0neGal <mail@0negal.com>2022-11-23 15:08:51 +0100
committerGitHub <noreply@github.com>2022-11-23 15:08:51 +0100
commit855d83cdd1cc6397069c9df243f32bf210693fd6 (patch)
tree0db4bab6e26eb3fcb533957ffa25d585b4c52b51 /src/app
parentee7858c71f671cca7914482a86e62ba48cf36dce (diff)
parent3ddd971820dea6a0c4a25009484e86afbfe7eaf1 (diff)
downloadViper-855d83cdd1cc6397069c9df243f32bf210693fd6.tar.gz
Viper-855d83cdd1cc6397069c9df243f32bf210693fd6.zip
Merge branch 'main' into dupe-mods-localization
Diffstat (limited to 'src/app')
-rw-r--r--src/app/main.js19
-rw-r--r--src/app/toast.js6
2 files changed, 24 insertions, 1 deletions
diff --git a/src/app/main.js b/src/app/main.js
index bd25071..9d59cbc 100644
--- a/src/app/main.js
+++ b/src/app/main.js
@@ -138,6 +138,25 @@ ipcRenderer.on("ns-update-event", (event, key) => {
}
});
+ipcRenderer.on("unknown-error", (event, err) => {
+ new Toast({
+ timeout: 10000,
+ scheme: "error",
+ title: lang("gui.toast.title.unknown_error"),
+ description: lang("gui.toast.desc.unknown_error"),
+ callback: () => {
+ new Toast({
+ timeout: 15000,
+ scheme: "error",
+ title: "",
+ description: err.stack.replaceAll("\n", "<br>")
+ })
+ }
+ })
+
+ console.error(err.stack)
+})
+
let lastselected = "";
function select(entry) {
let entries = document.querySelectorAll("#modsdiv .mod .modtext");
diff --git a/src/app/toast.js b/src/app/toast.js
index 9cb8996..3bc1745 100644
--- a/src/app/toast.js
+++ b/src/app/toast.js
@@ -3,6 +3,7 @@ function Toast(properties) {
fg: "#000000",
bg: "#FFFFFF",
timeout: 3000,
+ callback: () => {},
title: "Untitled Toast",
description: "No description provided for toast",
...properties
@@ -34,7 +35,10 @@ function Toast(properties) {
el.style.background = toast.bg;
el.id = id;
- el.setAttribute("onclick", `dismissToast(${id})`);
+ el.addEventListener("click", () => {
+ dismissToast(id);
+ toast.callback();
+ })
el.innerHTML = `
<div class="title">${toast.title}</div>