mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-15 07:31:33 +00:00
v2.2
This commit is contained in:
30
main.js
30
main.js
@@ -154,9 +154,13 @@ function openIt() {
|
||||
|
||||
function close (e, force) {
|
||||
console.log('close:', force);
|
||||
mainWindow.hide();
|
||||
e && e.preventDefault();
|
||||
mainWindow.webContents.send('closeWindow');
|
||||
if (mainWindow) {
|
||||
mainWindow.hide();
|
||||
e && e.preventDefault();
|
||||
mainWindow.webContents.send('closeWindow');
|
||||
} else {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
// 以前的关闭是真关闭, 现是是假关闭了
|
||||
@@ -177,17 +181,25 @@ function openIt() {
|
||||
// 前端发来可以关闭了
|
||||
ipc.on('quit-app', function(event, arg) {
|
||||
console.log('get quit-app request');
|
||||
mainWindow.destroy();
|
||||
mainWindow = null;
|
||||
if (mainWindow) {
|
||||
mainWindow.destroy();
|
||||
mainWindow = null;
|
||||
} else {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
|
||||
pdfMain.init();
|
||||
|
||||
function show () {
|
||||
mainWindow.show();
|
||||
mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
mainWindow.webContents.send('focusWindow');
|
||||
if (mainWindow) {
|
||||
mainWindow.show();
|
||||
mainWindow.restore();
|
||||
mainWindow.focus();
|
||||
mainWindow.webContents.send('focusWindow');
|
||||
} else {
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
||||
var trayShowed = false;
|
||||
|
Reference in New Issue
Block a user