Created
April 3, 2023 21:12
-
-
Save VerteDinde/2bb5a89db1c72116615dba408f60df74 to your computer and use it in GitHub Desktop.
crashReporter testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<title>CrashReporter</title> | |
</head> | |
<body> | |
<h1>CrashReporter Demo</h1> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Submit crash reports to a remote server. | |
// | |
// For more info, see: | |
// https://electronjs.org/docs/api/crash-reporter | |
const { app, BrowserWindow, crashReporter } = require('electron') | |
const path = require('path') | |
crashReporter.rateLimit = true; // comment this out (2) | |
crashReporter.start({ | |
productName: 'YourName', | |
companyName: 'YourCompany', | |
submitURL: 'https://your-domain.com/url-to-submit', | |
rateLimit: true, // comment this out (1) | |
uploadToServer: true | |
}) | |
app.whenReady().then(() => { | |
const mainWindow = new BrowserWindow({ | |
height: 600, | |
width: 600, | |
webPreferences: { | |
nodeIntegration: false, // default in Electron >= 5 | |
contextIsolation: true, // default in Electron >= 12 | |
preload: path.join(__dirname, 'preload.js') | |
} | |
}) | |
mainWindow.loadFile('index.html') | |
mainWindow.webContents.on('crashed', () => { | |
consolg.log(`crashReporter params: ${crashReporter.getParameters()}`) | |
console.log('Window crashed!') | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "painstaking-population-pretend-h2r7z", | |
"productName": "painstaking-population-pretend-h2r7z", | |
"description": "My Electron application description", | |
"keywords": [], | |
"main": "./main.js", | |
"version": "1.0.0", | |
"author": "khammond", | |
"scripts": { | |
"start": "electron ." | |
}, | |
"dependencies": {}, | |
"devDependencies": { | |
"electron": "22.2.1" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
setTimeout(() => { | |
process.crash() | |
}, 2000) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment