Electron Dialog
Contents
Synchronous API
ShowOpenDialogSync
ShowSaveDialogSync
ShowMessageBoxSync
Asynchronous API
ShowOpenDialog
ShowSaveDialog
const template = {
title: "Save As",
defaultPath: myDocuments,
properties: ["showOverwriteConfirmation"],
filters: [
{ name: "Markdown", extensions: ["md"] },
{ name: "Plain Text", extensions: ["txt"] },
],
};
dialog.showSaveDialog(win, template)
.then(r => {
if (r.canceled) console.log("File not saved");
else console.log("File saved");
});
ShowMessageBox
const template= {
message: "Something failed",
buttons: ["&Cancel", "&Try Again"],
type: "error",
normalizeAccessKeys: true,
};
dialog.showMessageBox(win, template)
.then(r => {
if (r.response==0) console.log("Cancelling");
else console.log("Trying again");
});
ShowErrorBox
ShowCertificateTrustDialog
