|
|
@ -1,4 +1,4 @@
|
|
|
|
import { app, ipcMain } from "electron";
|
|
|
|
import { app, ipcMain, dialog } from "electron";
|
|
|
|
import match from "@njzy/unblockneteasemusic";
|
|
|
|
import match from "@njzy/unblockneteasemusic";
|
|
|
|
|
|
|
|
|
|
|
|
export function initIpcMain(win, store) {
|
|
|
|
export function initIpcMain(win, store) {
|
|
|
@ -25,33 +25,34 @@ export function initIpcMain(win, store) {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
ipcMain.on('close', (e) => {
|
|
|
|
ipcMain.on("close", (e) => {
|
|
|
|
if (process.platform == 'darwin') {
|
|
|
|
if (process.platform == "darwin") {
|
|
|
|
//判断mac
|
|
|
|
|
|
|
|
win.hide();
|
|
|
|
win.hide();
|
|
|
|
})
|
|
|
|
}
|
|
|
|
e.preventDefault()//阻止默认行为
|
|
|
|
e.preventDefault(); //阻止默认行为
|
|
|
|
dialog.showMessageBox({
|
|
|
|
dialog
|
|
|
|
type: 'info',
|
|
|
|
.showMessageBox({
|
|
|
|
title: 'Information',
|
|
|
|
type: "info",
|
|
|
|
cancelId:2,
|
|
|
|
title: "Information",
|
|
|
|
|
|
|
|
cancelId: 2,
|
|
|
|
defaultId: 0,
|
|
|
|
defaultId: 0,
|
|
|
|
message: '确定要关闭吗?',
|
|
|
|
message: "确定要关闭吗?",
|
|
|
|
buttons: ['最小化','直接退出']
|
|
|
|
buttons: ["最小化", "直接退出"],
|
|
|
|
}).then(result => {
|
|
|
|
})
|
|
|
|
|
|
|
|
.then((result) => {
|
|
|
|
if (result.response == 0) {
|
|
|
|
if (result.response == 0) {
|
|
|
|
e.preventDefault(); //阻止默认行为
|
|
|
|
e.preventDefault(); //阻止默认行为
|
|
|
|
win.minimize(); //调用 最小化实例方法
|
|
|
|
win.minimize(); //调用 最小化实例方法
|
|
|
|
} else if(result.response == 1) {
|
|
|
|
} else if (result.response == 1) {
|
|
|
|
win = null;
|
|
|
|
win = null;
|
|
|
|
//app.quit();
|
|
|
|
//app.quit();
|
|
|
|
app.exit(); //exit()直接关闭客户端,不会执行quit();
|
|
|
|
app.exit(); //exit()直接关闭客户端,不会执行quit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}).catch(err => {
|
|
|
|
|
|
|
|
console.log(err)
|
|
|
|
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
.catch((err) => {
|
|
|
|
|
|
|
|
console.log(err);
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ipcMain.on("minimize", () => {
|
|
|
|
ipcMain.on("minimize", () => {
|
|
|
|
win.minimize();
|
|
|
|
win.minimize();
|
|
|
|