Last active
August 7, 2016 21:07
-
-
Save paulrouget/18f66331de2544c87755 to your computer and use it in GitHub Desktop.
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
var app = require('app'); | |
var dockMenu = [ | |
{ label: 'New Window', click: () => newWindow() }, | |
{ label: 'New Private Window', click: () => newWindow({isPrivate:true}) }, | |
]; | |
app.dock.setMenu(dockMenu); | |
var BrowserWindow = require('browser-window'); | |
app.on('window-all-closed', function() { | |
app.quit(); | |
}); | |
let downloadCount = 0; | |
function newWindow({isPrivate}) { | |
var win = new BrowserWindow({ width: 800, height: 600, show: false }); | |
win.on('closed', () => { | |
win = null; | |
}); | |
win.loadUrl('./browser.html'); | |
win.show(); | |
win.maximise(); | |
win.on('download-done', (progress) => { | |
app.dock.bounce(); | |
downloadCount++; | |
app.dock.setBadge(downloadCount) | |
}); | |
} | |
newWindow(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment