From 44210691ee8444509ac466a362337af77f2bcd49 Mon Sep 17 00:00:00 2001 From: Minteck <46352972+Minteck@users.noreply.github.com> Date: Tue, 20 Jul 2021 01:30:23 +0200 Subject: Commit --- views/script/core_crash.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 views/script/core_crash.js (limited to 'views/script/core_crash.js') 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 -- cgit