From 90d057c6d733837e273bfc9306bb5c0ecc62f86d Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Sun, 22 May 2016 09:00:56 +0200 Subject: [PATCH] :arrow_up: crash-reporter. --- crash-report/app.js | 8 +++--- crash-report/main.js | 51 +++++++++++++++++++-------------------- crash-report/package.json | 2 +- 3 files changed, 30 insertions(+), 31 deletions(-) diff --git a/crash-report/app.js b/crash-report/app.js index fbc2768..05318c2 100644 --- a/crash-report/app.js +++ b/crash-report/app.js @@ -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 "" + report.date + "" + @@ -15,8 +15,8 @@ window.onload = function() { "\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() { diff --git a/crash-report/main.js b/crash-report/main.js index ecf4fab..ee002a1 100644 --- a/crash-report/main.js +++ b/crash-report/main.js @@ -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(); + }); +}); diff --git a/crash-report/package.json b/crash-report/package.json index 46af520..ea9e0a1 100644 --- a/crash-report/package.json +++ b/crash-report/package.json @@ -1,5 +1,5 @@ { "name" : "crash-report-demo", - "version" : "0.1.0", + "version" : "1.1.0", "main" : "main.js" }