6.1 Creating toast

A UDI can create “toast”: a short-lived pop-up message to the user, displayed at the edge of the screen. You create toast using the UDI.createToast() function. This takes two parameters: a definition of the toast to display, and an optional callback function which receives a notification if the user clicks on the toast. For example:

UDI.createToast({
	title: "Band breakout",
	text: "Price is above trend band"
}, function(toastDef) {
	// User has clicked on the toast
	// toastDef parameter is the definition passed to createToast
});

The available options for toast are described in full in the Framework reference, but the key values are as follows:

Property

Description

text

Body text of the notification

title

Title for the notification. (Not compulsory.)

icon

Hexadecimal code of an icon in the FontAwesome set, such as "f05a" for an info icon. (Not compulsory.)

lifespan

Lifespan of the toast in seconds, overriding the app's default

Last updated