Skip to content

Instantly share code, notes, and snippets.

@paulrouget
Last active August 7, 2016 21:07
Show Gist options
  • Save paulrouget/18f66331de2544c87755 to your computer and use it in GitHub Desktop.
Save paulrouget/18f66331de2544c87755 to your computer and use it in GitHub Desktop.
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