Skip to content
Matteo Bernardini edited this page Sep 9, 2017 · 7 revisions

This project is a light JS library providing basic modal dialogs for webpages, aiming to replace the built-in alert(), prompt() and confirm() which instead block JavaScript execution (hence the name "asynchronous").

The library provides one function dialog() in the global namespace (window), taking as argument an object of properties and returning a Promise to a status object..

prop = {
	type: "alert",
	title: "Message",
	content: "Hello, world!",
};

dialog(prop).then(myFunc);
// Shows the dialog box and calls `myFunc` after closing it

How to include

The inclusion on a project is straightforward and only consist of adding the script and the default stylesheet:

<link rel="stylesheet" type="text/css" href="/path/to/dialog_default.css">
<script type="text/javascript" src="/path/to/dialog.js"></script>

Resources

License and sharing

Made by: Matteo Bernardini, @mttbernardini.
This project is licensed under the MIT license.

Clone this wiki locally