Easy isomorphic dialogs for Electron apps.
You can trigger them from both the renderer process and the main process. From the renderer process the currently active window will be inferred, but from the main process you have to explicitly pass the browserWindow
argument.
npm install --save electron-dialog
import Dialog from 'electron-dialog';
Dialog.alert ( 'My message' );
Dialog.confirm ( 'Do you like this?' );
Dialog.choice ( 'What is your favorite framework?', ['Cancel', 'Qt', 'Electron'] );
Default options for all future dialogs.
Open a custom dialog with the provided options.
Show an alert with the provided message.
Show a confirmation dialog with the provided message and Cancel
- Yes
as the choices.
The return value is true
if Yes
is clicked, false
otherwise.
Dialog.choice ( message: string, buttons: string[], browserWindow?: Electron.BrowserWindow ): clickedButtonIndex
Show a confirmation dialog with buttons
as the choices.
The return value is the index of the clicked button.
MIT © Fabio Spampinato