mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-14 23:22:40 +00:00
mac下关闭窗口是隐藏, 不必stop server
This commit is contained in:
@@ -23,7 +23,7 @@ $(function() {
|
||||
|
||||
$('.tool-close, .tool-close-blur').click(function() {
|
||||
// mac下关闭才是隐藏
|
||||
onClose(function() {
|
||||
onCloseNotStopServerForMac(function() {
|
||||
gui.win.hide();
|
||||
});
|
||||
// gui.win.showInactive();
|
||||
|
@@ -1779,6 +1779,33 @@ var onClose = function(afterFunc) {
|
||||
}
|
||||
}
|
||||
|
||||
// 如果是mac, 当关闭窗口时不要stop server
|
||||
var onCloseNotStopServerForMac = function(afterFunc) {
|
||||
function o () {
|
||||
SyncService.stop();
|
||||
// 先保存之前改变的
|
||||
Note.curChangedSaveIt();
|
||||
// 保存状态
|
||||
State.saveCurState(function() {
|
||||
afterFunc && afterFunc();
|
||||
});
|
||||
}
|
||||
try {
|
||||
if (isMac()) {
|
||||
o();
|
||||
}
|
||||
else {
|
||||
// 先把服务/协议关掉
|
||||
Server.close(function () {
|
||||
o();
|
||||
});
|
||||
}
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
afterFunc && afterFunc();
|
||||
}
|
||||
}
|
||||
|
||||
function isURL(str_url) {
|
||||
var re = new RegExp("^((https|http|ftp|rtsp|mms|emailto)://).+");
|
||||
return re.test(str_url);
|
||||
|
Reference in New Issue
Block a user