electron-dialogbox
Version:
The utility for making simple html base dialog box for Electron base application.
35 lines (27 loc) • 857 B
JavaScript
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
const eDialog = require('electron-dialogbox');
async function showDialog(name) {
try {
let args = {name: name, a:0, b:{}};
let result = await eDialog.showDialog(
'file:///'+__dirname+'/index1.html',
{width: 400, height: 300},
args
);
await new Promise(r => setTimeout(()=> r(), 2000));
console.log(name, 'args = ', JSON.stringify(args,null,2));
console.log(name, 'result = ', JSON.stringify(result,null,2));
} catch(e) {
console.log('dialog emit error: ', e);
}
}
app.on('window-all-closed', function() {
});
app.on('ready', async function() {
let p = [ showDialog('A'), showDialog('B') ];
await Promise.all(p);
console.log('quit');
app.quit();
})