aboutsummaryrefslogtreecommitdiff
path: root/views/script/core_crash.js
diff options
context:
space:
mode:
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..1a12230
--- /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