Quit when all windows are closed if running an app by passing it in command line.
This commit is contained in:
parent
a00bf3e1e1
commit
3c0671c179
1 changed files with 7 additions and 0 deletions
|
@ -1,7 +1,14 @@
|
||||||
|
var app = require('app');
|
||||||
var argv = require('optimist').argv;
|
var argv = require('optimist').argv;
|
||||||
var dialog = require('dialog');
|
var dialog = require('dialog');
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
|
|
||||||
|
// Quit when all windows are closed and no other one is listening to this.
|
||||||
|
app.on('window-all-closed', function() {
|
||||||
|
if (app.listeners('window-all-closed').length == 1)
|
||||||
|
app.quit();
|
||||||
|
});
|
||||||
|
|
||||||
// Start the specified app if there is one specified in command line, otherwise
|
// Start the specified app if there is one specified in command line, otherwise
|
||||||
// start the default app.
|
// start the default app.
|
||||||
if (argv._.length > 0) {
|
if (argv._.length > 0) {
|
||||||
|
|
Loading…
Reference in a new issue