Skip to content

Commit

Permalink
⬆️ crash-reporter.
Browse files Browse the repository at this point in the history
  • Loading branch information
hokein committed May 22, 2016
1 parent 0363a10 commit 90d057c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 31 deletions.
8 changes: 4 additions & 4 deletions crash-report/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var crashReporter = require('crash-reporter');
const {crashReporter} = require('electron');

crashReporter.start({submitUrl: 'http://127.0.0.1:9999'});
crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'});

function showCrashReporter(report) {
return "<tr><td>" + report.date + "</td>" +
Expand All @@ -15,8 +15,8 @@ window.onload = function() {
"</tr>\n";

var div = document.getElementById("crash_reporters");
for (var i = 0; i < reporters.length; ++i) {
table += showCrashReporter(reporters[i]);
for (let reporter of reporters) {
table += showCrashReporter(reporter);
}
div.innerHTML = table;
document.getElementById('crash').onclick = function() {
Expand Down
51 changes: 25 additions & 26 deletions crash-report/main.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
var app = require('app');
var BrowserWindow = require('browser-window');
var http = require('http');
var crashReporter = require('crash-reporter');
crashReporter.start({submitUrl: 'http://127.0.0.1:9999'});

function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}

// Crash-report collection server
var server = http.createServer(function(req, res) {
// Handle the uploaded crash report from client here
// ...
// Response the crash report id on server to client.
res.end(getRandomInt(1000, 9999).toString());
});

var mainWindow = null;
app.on('ready', function() {
server.listen(9999, '127.0.0.1', function () {
mainWindow = new BrowserWindow({width: 800, height: 600});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
mainWindow.toggleDevTools();
});
});
const {app, BrowserWindow, crashReporter} = require('electron');
const http = require('http');

crashReporter.start({submitURL: 'http://127.0.0.1:9999', companyName: 'sample'});

function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}

// Crash-report collection server
var server = http.createServer(function(req, res) {
// Handle the uploaded crash report from client here
// ...
// Response the crash report id on server to client.
res.end(getRandomInt(1000, 9999).toString());
});

var mainWindow = null;
app.on('ready', function() {
server.listen(9999, '127.0.0.1', function () {
mainWindow = new BrowserWindow({width: 800, height: 600});
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.toggleDevTools();
});
});
2 changes: 1 addition & 1 deletion crash-report/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name" : "crash-report-demo",
"version" : "0.1.0",
"version" : "1.1.0",
"main" : "main.js"
}

0 comments on commit 90d057c

Please sign in to comment.