This project is a light JS library providing basic asynchronous modal dialogs for webpages, aiming to replace the built-in alert(), prompt() and confirm() which instead block JavaScript execution.
The library provides one function dialog() in the global namespace (window), taking as argument an object of properties and returning a Promise resolving to the result object.
prop = {
	type: "alert",
	title: "Message",
	content: "Hello, world!",
};
dialog(prop).then(myFunc);
// Shows the dialog box and calls `myFunc` after closing itThe 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>A short and effective documentation for all the supported properties can be found at the beginning of the dialog.js file.
A more detailed documentation providing examples can be found in the wiki
You can see three live examples here.
The software is compatible with all major browsers. A polyfill might be needed in order to support Promises, no other ES6 features are used.
The stylesheet is W3C valid. A prefixer (like -prefix-free) might be needed in order to add vendor prefixes.
© 2015 Matteo Bernardini, @mttbernardini.
This project is licensed under the MIT License.
Please refer to the LICENSE file for further information.