Socket
Book a DemoInstallSign in
Socket

dialogjs

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dialogjs

Javascript dialog alternative using promise. Supports alert, confirm, and prompt with text and password input.

0.9.3
latest
npmnpm
Version published
Weekly downloads
4
300%
Maintainers
1
Weekly downloads
 
Created
Source

DialogJS

Javascript dialog alternative using promise.

Installation

Using NPM:

npm install dialogjs --save

Then, add dialog.min.css and dialog.min.js from dist directory to your project html file.

<link rel="stylesheet" type="text/css" href="npm_modules/dialogjs/dist/dialog.min.css">
<script type="text/javascript" src="npm_modules/dialogjs/dist/dialog.min.js"></script>

Usage

After required files are inserted, you can access Dialog object from your script.

Alert

Display alert dialog box, can be used for displaying important information that requires user's attention.

Dialog.alert('Title','Message you want to show.')
.then(function(){
    console.log("You clicked OK");
},function(){
    console.log("You didn't click OK");
});

Confirm

Display confirmation dialog box with Yes or No options.

Dialog.confirm('Question','Am I good enough?')
.then(function(){
    console.log("You answered Yes");
},function(){
    console.log("You answered No");
});

Prompt

Display prompt dialog box with an input. Input types can be defined via option type. Currently, possible values for input types are: text (default) and password.

Default Text Input

Dialog.prompt('Dialog Title','Message to be displayed')
.then(function(value){
    // user clicked OK button, access user input via 'value' variable.
    console.log('Your input is: ' + value);
},function(){
    // user clicked Cancel button or closed the dialog.
    console.log("You clicked Cancel");
});

Password Input

Dialog.prompt('Dialog Title','Message to be displayed', { type: 'password' })
.then(function(value){
    // user clicked OK button, access user input via 'value' variable.
    console.log('Your input is: ' + value);
},function(){
    // user clicked Cancel button or closed the dialog.
    console.log("You clicked Cancel");
});

License & Attributions

This project is published under MIT license. This project was originally forked from coderaiser/smalltalk. Thanks to coderaiser for the great work of Smalltalk.

Keywords

dialog

FAQs

Package last updated on 01 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.