Skip to content
This repository has been archived by the owner on Jun 1, 2022. It is now read-only.

fabiospampinato/electron-dialog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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-dialog

Usage

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

About

Easy isomorphic dialogs for Electron apps.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published