我有一个消息框,当用户在dashboardWindow 上单击关闭时将打开该消息框(Windows 操作系统右上角的 X 按钮)
dashboardWindow.on("close", (event) => {
event.preventDefault();
console.log("before message box");
dialog.showMessageBox(
dashboardWindows,
{
message: "Test",
buttons: ["Default Button", "Cancel Button"],
defaultId: 0, // bound to buttons array
cancelId: 1 // bound to buttons array
},
(response) => {
if (response === 0) {
// bound to buttons array
console.log("Default button clicked.");
} else if (response === 1) {
// bound to buttons array
console.log("Cancel button clicked.");
}
}
);
console.log("after message box");
});
}
Run Code Online (Sandbox Code Playgroud)
当我关闭 dashboardWindow 时消息框打开,但我无法开始 …