This module is the basic module for creating messages. It is used to generate messages, not to process them. Other modules -like 'dialog' can process the messages and display them on the screen.
With nodejs:
The module messages
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>
messages
are promises
that can be generated by this module. They are promises with specific message-properties and once generated, this module will emit one of these events:
Other modules can subscribe to these events and handle the message. The idea is that the message can be handled as long as its promise is not resolved. Also, processing the message means when finished processing, the promise should be made resolved.
This module comes with several methods:
The next methods all return a promise:
Generates a general message. Can be used directly, or used by other methods (like alert
)
Generates a simple message.
Generates an alert.
Generates an prompt with an input-element.
Method to be used to catch system-errors and redirect them through the message-system.
ITSA.alert('I am an alert');
Note: the dialog
-module takes care of handling this message
Messages need to be handled by separate modules. The dialog
-module for example, is set up to handle all '.message', ':warn' and '*:error' messages by default. If you create you own message-handler, you could create a before-listener
to handle some of these messages and use e.halt() to prevent them from reaching dialog
.