electron-dialogs
A simple library that allows you to create dialogs like alert, confirm and prompt in Electron applications easily and quickly.
Newests
- Now you can use the progress function.
- New styles for dialogs.
- Now you can create multiple dialogs at the same time without interfering with each other.
Basic Usage
Installation
npm i electron-dialogs
yarn add electron-dialogs
Main codes
// Require main function from electron-dialogsconst main = ; // Create an Electron windowconst win = width: 800 height: 600 webPreferences: nodeIntegration: true webSecurity: false ; // Set a file to be loaded by your windowwin; // Set a window and a channel to electron-dialogs;
Renderer codes
// Require electron-dialogs and pass the same channel you did on Mainconst dialogs = ;
Alert function
dialogs; // Or await dialogs; console;
Confirm function
dialogs; // Or const confirmed = await dialogs; ifconfirmed console;
Prompt function
dialogsprompt title: 'My prompt' message: 'This is a prompt from electron-dialogs.' value: 'My prompt value' confirmText: 'OK' cancelText: 'Cancel' { if!rescanceled console;}; // Or const canceled value = await dialogsprompt title: 'My prompt' message: 'This is a prompt from electron-dialogs.' value: 'My prompt value' confirmText: 'OK' cancelText: 'Cancel'; if!canceled console;
Progress function
const changeStatus finish = dialogs; ; ; ; ; // ATTENTION!// When 'autoClose' is true, the dialog is closed when the finish function is called.// When 'changeableBar' is false, the progress bar will always be filled// The progress dialog can only be closed or dismissed after the finish function is called.
Tell me about an error you found or a good idea you had. ;)
iurigmsv@outlook.com
Nice coding! :)