NuMessage

From nuBuilderForte
Jump to navigation Jump to search

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


Message only without title:


To display a single message:

nuMessage('hello');

To display a message from an array:

nuMessage(['message']);

To display multiple lines of messages:

nuMessage(['message line 1', 'message line 2']);

Show a message for 2 seconds (2000 ms):

To display a message with a duration of 2000 milliseconds:

nuMessage('hello', 2000);


Title and Message:


To display a title with a message:

nuMessage('Information', 'Message here...');

To display a title with multiple lines of messages:

nuMessage('Information', ['message line 1', 'message line 2']);

To display a title with multiple lines of messages for 2000 milliseconds:

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:

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:

nuMessage('Information', ['message line 1', 'message line 2'], 2000, msgClosedCallback);