Module-documentation

version 1.0.0
module: dialog version 0.0.1
size-min gzipped: 1.99 kb (incl. dependencies: 15.32 kb)
dependencies: polyfill/polyfill-base.js, js-ext/lib/function.js, js-ext/lib/object.js, utils, event
maintanance: Marco Asbreuk
home


all modules

Dialog to process messages

This module processes messages by prompting a modal panel.

Getting Started

With nodejs:

The module dialog is a typical browser-module.

In the browser:

For browser-usage, ITSA has a predefined loaderfiles. Once included, a global ITSA object with default features is available. For customized loaderfiles, read: Customized build.

<script src="/itsabuild-min.js"></script>
<script>
    var Dialog = ITSA.Dialog;
</script>
When using your own customized build-file, this module-requirement needs to be invoked with the window-object.

The Basics

The messages-module generates messages by emitting appropriate events. This module subscribes to the following events:

These events are caught and handled by dialog. When multiple messages occur simultaniously, the get inside a queue, where all messages are handled one by one (FIFO). However, error-messages have higher priority than warn-messages, which have higher priority than normal messages. When a messages gets in the queue that has a higher priority than the current message displayed, the the current messages gets back in the queue, to enable the higher-priority message to be displayed.

Messages get finished once the dialog-panel is closed (on of the button is pressed), which will resolve the message-promise. When a message-promise inside the queue gets resolved, it will be removed out of the queue.

Example alert

ITSA.alert('I am an alert').then(
    function() {
        // the message is closed here
    }
);

Example prompt

var askName = ITSA.prompt('Please enter your name:', {defaultValue: 'someone', label: 'Name'});

askName.then(function(value) {
    ITSA.alert('Your name is: '+value);
});
API Docs

Table of Contents