diff --git a/index.js b/index.js index 904047ea..8ab41412 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,5 @@ +var startTime = Date.now() + require('debug/browser') var debug = require('debug')('index') @@ -22,9 +24,6 @@ function onOpen (e, torrentId) { // autoSubmit: true // }) -// adds debug features like hotkeys for triggering dev tools and reload -require('electron-debug')() - // prevent windows from being garbage collected var mainWindow // eslint-disable-line no-unused-vars @@ -65,8 +64,9 @@ function createMainWindow () { win.loadURL('file://' + path.join(__dirname, 'main', 'index.html')) win.webContents.on('did-finish-load', function () { setTimeout(function () { + debug('startup time: %sms', Date.now() - startTime) win.show() - }, 30) + }, 50) }) win.on('close', function (e) { if (process.platform === 'darwin' && !isQuitting) { @@ -188,7 +188,7 @@ var template = [ else return 'Ctrl+Shift+I' })(), click: function (item, focusedWindow) { - if (focusedWindow) focusedWindow.toggleDevTools() + devTools(focusedWindow) } } ] @@ -284,6 +284,23 @@ if (process.platform === 'darwin') { ) } +function devTools (win) { + win = win || electron.BrowserWindow.getFocusedWindow() + + if (win) { + win.toggleDevTools() + } +} + +function reload (win) { + win = win || electron.BrowserWindow.getFocusedWindow() + + if (win) { + startTime = Date.now() + win.webContents.reloadIgnoringCache() + } +} + // var progress = 0 // setInterval(function () { // progress += 0.1 diff --git a/package.json b/package.json index 6a4249f8..96a4d2a6 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,6 @@ "create-torrent": "^3.22.1", "debug": "^2.2.0", "drag-drop": "^2.3.1", - "electron-debug": "^0.5.0", "network-address": "^1.1.0", "pretty-bytes": "^3.0.0", "throttleit": "^1.0.0",