aboutsummaryrefslogtreecommitdiff
path: root/views/script/core_crash.js
diff options
context:
space:
mode:
authorMinteck <46352972+Minteck@users.noreply.github.com>2021-07-20 01:30:23 +0200
committerMinteck <46352972+Minteck@users.noreply.github.com>2021-07-20 01:30:23 +0200
commit44210691ee8444509ac466a362337af77f2bcd49 (patch)
tree4dc2f242cf5fd4daa3fc6f9e42516e7d55b73538 /views/script/core_crash.js
parentefa5fc926071de7087836d399c42f53e701b4cff (diff)
downloadkartik-client-44210691ee8444509ac466a362337af77f2bcd49.tar.gz
kartik-client-44210691ee8444509ac466a362337af77f2bcd49.tar.bz2
kartik-client-44210691ee8444509ac466a362337af77f2bcd49.zip
Commit
Diffstat (limited to 'views/script/core_crash.js')
-rw-r--r--views/script/core_crash.js21
1 files changed, 21 insertions, 0 deletions
diff --git a/views/script/core_crash.js b/views/script/core_crash.js
new file mode 100644
index 0000000..d24ec2d
--- /dev/null
+++ b/views/script/core_crash.js
@@ -0,0 +1,21 @@
+global.gameCrashed = false;
+crashSound = new Audio("./sfx/gamecrash.wav");
+
+function destroy() {
+ global.gameCrashed = true;
+ crashSound.play();
+ require('@electron/remote').webContents.fromId(webview.getWebContentsId()).forcefullyCrashRenderer();
+ try { musicElement.pause(); } catch (e) {}
+}
+
+function spawnError(crashReport) {
+ document.getElementById("error-outer").style.display = "flex";
+ document.getElementById("crash-dump").value = crashReport;
+ destroy();
+}
+
+const crashHandler = require('electron').ipcRenderer;
+
+crashHandler.on('crashreport', (event, args) => {
+ spawnError(args);
+}) \ No newline at end of file