I just started using electron and fail to use showmessageBoxSync
: it returns the error:
type error dialog.showmessageBoxSync is not a function
isn't showmessageBoxSync
a member of dialog
which is a property of returned object returned by require('electron');
? what am I missing? the dialog variable is declared as:
const { app, BrowserWindow, dialog } = require('electron');
this is the full code:
const { app, BrowserWindow, dialog } = require('electron');
const url = require('url');
function newApp() {
dialog.showmessageBoxSync({
message: 'hello world'
});
win = new BrowserWindow();
win.loadURL(
url.format({
pathname: "index.html",
slashes: true
})
);
win.on('closed', () => {
win = null;
});
}
app.on("ready", newApp);
The method is dialog.showMessageBoxSync
, with a capital M.