A widget, script, or UDIX can create its own toast pop-ups using
Framework.CreateToast({
title: "Finished!",
text: "The task has been completed",
icon: "f05a"
});
// These two calls are identical:
Framework.CreateToast("My message");
Framework.CreateToast({text: "My message"});
The standard properties of the toast definition 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 |
Framework.CreateToast({
title: "Finished!",
text: "The task has been completed",
icon: "f05a"
}, function (ToastMsg) {
if (ToastMsg.clicked) {
// User has clicked on the toast
} else {
// The toast is being destroyed
}
});
The
| Property | Description |
| clicked | Indicates whether the message is the result of a click. If not, then it means that the toast is being destroyed and no further messages will be sent. |
| toastId | ID assigned to the toast |
| toast | Definition of the toast, as originally passed in to |
By default, a toast notification is destroyed if the user clicks on it. Therefore, unless you modify the standard behaviour using the properties described below, if the user clicks on the toast then there will be two messages: a click message with
Other properties which you can use to modify the toast are as follows:
| Property | Description |
| lifespan | Lifespan of the toast in seconds, overriding the app's default |
| toastId | Optional ID to assign to the toast, so that the toast has a known ID which can be manually destroyed. Callers are recommended to use FXB.utils.GenerateGuid(). |
| noDestroyOnClick | Prevents the toast being automatically destroyed when the user clicks on it. The caller can destroy it manually (rather than waiting for its natural expiry) by implementing a click callback and using that to destroy the toast. |
| toastCreationGroup | Ignored if blank/null. Suppresses creation of this new toast if there are any existing items with the same |
| toastReplacementGroup | Ignored if blank/null. The opposite of |
| toastClickGroup | Ignored if blank/null. Automatically destroys all the items with the same |
| toastClass | Optional display class for the toast, changing its formatting. Currently available values are |
| dialog | Optional description of a dialog to display in response to a click on the toast. See below. |