[Updated] nuMessage()
Posted: Wed May 29, 2024 10:25 am
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.
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:
To display a message from an array:
To display multiple lines of messages:
Show a message for 2 seconds (2000 ms):
To display a message with a duration of 2000 milliseconds:
Title and Message:
To display a title with a message:
To display a title with multiple lines of messages:
To display a title with multiple lines of messages for 2000 milliseconds:
Callback when message is closed:
Define a callback function to execute when the message is closed:
To display a title with multiple lines of messages for 2000 milliseconds and execute a callback when the message is closed:
In addition, the message can now be closed via the ‘x’ icon.
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');
Code: Select all
nuMessage(['message']);
Code: Select all
nuMessage(['message line 1', 'message line 2']);
To display a message with a duration of 2000 milliseconds:
Code: Select all
nuMessage('hello', 2000);
To display a title with a message:
Code: Select all
nuMessage('Information', 'Message here...');
Code: Select all
nuMessage('Information', ['message line 1', 'message line 2']);
Code: Select all
nuMessage('Information', ['message line 1', 'message line 2'], 2000);
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.");
};
Code: Select all
nuMessage('Information', ['message line 1', 'message line 2'], 2000, msgClosedCallback);