aboutsummaryrefslogtreecommitdiff
path: root/views/script/core_crash.js
blob: 1a12230d83615612eac517f5780e6cd5b4a8839c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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);
})