Introduce a delay and a two-step close windows procedure to allow to receive and execute the order to close the machine when Kitematic closes on Windows.

This commit is contained in:
Alexandre Vázquez 2016-01-20 23:01:03 +01:00
Родитель dd569065d8
Коммит 24330408e9
1 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -7,10 +7,12 @@ import os from 'os';
import path from 'path';
import child_process from 'child_process';
let Promise = require('bluebird');
process.env.NODE_PATH = path.join(__dirname, 'node_modules');
process.env.RESOURCES_PATH = path.join(__dirname, '/../resources');
process.env.PATH = '/usr/local/bin:' + process.env.PATH;
var exiting = false;
var size = {}, settingsjson = {};
try {
@ -46,9 +48,15 @@ app.on('ready', function () {
});
if (os.platform() === 'win32') {
mainWindow.on('close', function () {
mainWindow.on('close', function (e) {
mainWindow.webContents.send('application:quitting');
return true;
if(!exiting){
Promise.delay(1000).then(function(){
mainWindow.close();
});
exiting = true;
e.preventDefault();
}
});
app.on('window-all-closed', function () {