Access to the current window


The dialog API for showMessageBox wants the first argument to be an instance of browserWindow. I’m trying to open it from a JS file loaded by my index.html. I tried this:

var remote = require('remote');
var dialog = remote.require('dialog');
dialog.showMessageBox(window, {title:"Title",message:"My message"});

and I tried using this instead of window, but it isn’t quite working. Any ideas?


From the docs it looks like BrowserWindow should be optional. What happens if you just do dialog.showMessageBox({title:"Title",message:"My message"})?


That worked. Well, I had to add buttons (will see if the docs need a bug report for that - I don’t think they were marked as required). Thank you!