2.0.0 • Published 6 years ago
electron-dialog v2.0.0
Electron Dialog
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.
Install
npm install --save electron-dialogUsage
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'] );Dialog.options = { type: 'none', noLink: true }
Default options for all future dialogs.
Dialog.open ( options, browserWindow?: Electron.BrowserWindow )
Open a custom dialog with the provided options.
Dialog.alert ( message: string, browserWindow?: Electron.BrowserWindow )
Show an alert with the provided message.
Dialog.confirm ( message: string, browserWindow?: Electron.BrowserWindow ): boolean
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.
License
MIT © Fabio Spampinato