Skip to content

Commit

Permalink
docs: update package.json
Browse files Browse the repository at this point in the history
  • Loading branch information
qier222 committed Jan 31, 2021
1 parent 51d11e8 commit a74a555
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 29 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "YesPlayMusic",
"version": "0.3.2",
"version": "0.3.3",
"private": true,
"description": "A third party music application for Netease Music",
"author": "hawtim<hawtimzhang@gmail.com>",
Expand Down
57 changes: 29 additions & 28 deletions src/electron/ipcMain.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { app, ipcMain } from "electron";
import { app, ipcMain, dialog } from "electron";
import match from "@njzy/unblockneteasemusic";

export function initIpcMain(win, store) {
Expand All @@ -24,34 +24,35 @@ export function initIpcMain(win, store) {
event.returnValue = null;
});
});

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

ipcMain.on("close", (e) => {
if (process.platform == "darwin") {
win.hide();
}
e.preventDefault(); //阻止默认行为
dialog
.showMessageBox({
type: "info",
title: "Information",
cancelId: 2,
defaultId: 0,
message: "确定要关闭吗?",
buttons: ["最小化", "直接退出"],
})
.then((result) => {
if (result.response == 0) {
e.preventDefault(); //阻止默认行为
win.minimize(); //调用 最小化实例方法
} else if (result.response == 1) {
win = null;
//app.quit();
app.exit(); //exit()直接关闭客户端,不会执行quit();
}
})
.catch((err) => {
console.log(err);
});
});


ipcMain.on("minimize", () => {
win.minimize();
Expand Down

0 comments on commit a74a555

Please sign in to comment.