Page 1 of 1

[Updated] nuMessage()

Posted: Wed May 29, 2024 10:25 am
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);