notification

Version Compatibility

notification was introduced in version 4.23.0 of the JourneyApps Container.

The notification UI component displays a message in a top-level bar to the user. It automatically fades out after a few seconds. notification needs to be triggered from JavaScript/TypeScript.

Example

main.js
notification.success("Your changes were saved successfully");

Notification types

Options

Version Compatibility

notification supports options since version 4.27 of the JourneyApps Container.

Examples:

var options = {
    timeout: 5 * 1000 // Display the notification for 5 seconds
};

notification.success("Your changes were saved successfully.", options);
var options = {
    color: '#C0FFEE',
    timeout: null
};

notification.show("The job was submitted successfully", options);

notification supports an options object as a second parameter with the following valid keys:

Buttons

notification supports buttons in the notification bar.

A button is an object with the following structure:

{
    label: "Button label here",
    onPress: function() {
        // Callback to execute when button is pressed
    }
}

To add buttons to the notification, add one or an array of the above object to the buttons property of the options object.

Examples:

2 buttons:

var options = {
  buttons: [{
    label: "Later",
    onPress: function() {
      // Dismiss the notification
    }
  }, {
    label: "View",
    onPress: function() {
      // Go to "View"
    }
  }]
};

notification.info("You have received a new message", options);

1 button:

var options = {
    color: 'primary',
    buttons: [{
        label: "View",
        onPress: function() {
        // Go to "View"
        }
    }]
};

notification.show("You have received a new message", options);

Last updated