node-webkit-fdialogs icon indicating copy to clipboard operation
node-webkit-fdialogs copied to clipboard

Window context in >= NW.js 0.13

Open vzamanillo opened this issue 9 years ago • 0 comments

With the new NW.js the dialog is never opened, now it is mandatory to specify the NW.js window object as option because the DOM window of node context is on a separate context and the browser context is not accesible.

So you can not use the exported module functions

fdialogs.readFile(function (err, content, path) {
});

fdialogs.saveFile(buff, function (err, path) {
});

You must use the exported FDialog in this way:

For save dialog:

var saveDialog = new fdialogs.FDialog({
    type: 'save',
    window: nw.Window.get().window
});
saveDialog.saveFile(buff, function (err, path) {
});

For open dialog:

var openDialog = new fdialogs.FDialog({
    type: 'open',
    window: nw.Window.get().window
});
openDialog.readFile(function (err, content, path) {
});

NW.js Separate context node

vzamanillo avatar Jun 20 '16 07:06 vzamanillo