electronjs-prompt

1.0.2 • Public • Published

_prompt

A Sync prompt that kinda copies the original prompt behavior for electronjs (untested outside of my laptop)

How to use

Simply require it in main.js

const {Prompt} = require("electronjs-prompt");

Then call the constructor (there's no personalisations yet for the windows and design)

async function loadMainWindow() {
    win = new BrowserWindow({
        width: 800, height: 600, show: false, webPreferences: {
            preload: path.join(__dirname, 'preload.js'), nodeIntegration: true, contextIsolation: false
        }, autoHideMenuBar: true
    })

    win.loadURL(`file://${app.getAppPath()}/public/index.html?app_path=${app.getAppPath()}`).then(r => {
        win.show();
    });

    win.webContents.on('did-finish-load', () => {
        win.maximize();
    });

    new Prompt(ipcMain);
}

You can then call prompt from your renderer using

return ipcRenderer.sendSync('prompt', msg);

It now also works with confirm and sends back an integer (0 | 1)

return ipcRenderer.sendSync('confirm', msg);

Readme

Keywords

Package Sidebar

Install

npm i electronjs-prompt

Weekly Downloads

2

Version

1.0.2

License

Apache-2.0

Unpacked Size

17.6 kB

Total Files

6

Last publish

Collaborators

  • islanzadie