Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

[Updated] nuMessage()

Information about updates, news, Code Library
admin
Site Admin
Posts: 2814
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

[Updated] nuMessage()

Unread post by admin »

nuMessage() has been extended so that a title / heading can now also be displayed.
In addition, the message can now be closed via the ‘x’ icon.

nuMessage.gif

The following shows various examples of how the function can be used and which parameters can be passed.

Message only:

To display a single message:

Code: Select all

nuMessage('hello');
message_only.png
To display a message from an array:

Code: Select all

nuMessage(['message']);
To display multiple lines of messages:

Code: Select all

nuMessage(['message line 1', 'message line 2']);
message_multiple_lines.png
Show a message for 2 seconds (2000 ms):

To display a message with a duration of 2000 milliseconds:

Code: Select all

nuMessage('hello', 2000);
Title and Message:

To display a title with a message:

Code: Select all

nuMessage('Information', 'Message here...');
message_with_header.png
To display a title with multiple lines of messages:

Code: Select all

nuMessage('Information', ['message line 1', 'message line 2']);
To display a title with multiple lines of messages for 2000 milliseconds:

Code: Select all

nuMessage('Information', ['message line 1', 'message line 2'], 2000);
Callback when message is closed:

Define a callback function to execute when the message is closed:

Code: Select all

const msgClosedCallback = function() {
    console.log("Timeout reached. Message has been closed.");
};
To display a title with multiple lines of messages for 2000 milliseconds and execute a callback when the message is closed:

Code: Select all

nuMessage('Information', ['message line 1', 'message line 2'], 2000, msgClosedCallback);
You do not have the required permissions to view the files attached to this post.
Post Reply