system.kanoa.toast.show(paramsDict)
Shows a toast notification and returns its id. Invalid arguments raise an error in the calling script.
From a Perspective script the toast is shown on the page the script is running on. From a Gateway script, sessionId and pageId are required. The function raises an error in the Designer Script Console.
Parameters
paramsDict Dictionary
| - message | String | Required. The toast's text, up to 1000 characters. |
| - title | String | Optional bold heading above the message, up to 1000 characters. |
| - type | String | info, success, warning, error or default (the default). Sets the color and icon. |
| - position | String | top-left, top-center, top-right, bottom-left, bottom-center (the default) or bottom-right. |
| - animate | String | The entrance and exit animation: bounce (the default), slide, zoom or flip. |
| - autoClose | Integer | Milliseconds before the toast closes. 0 keeps it open until it is dismissed. Defaults to 5000. |
| - closeButton | Boolean | Show the close button. Defaults to True. |
| - pauseOnHover | Boolean | Pause the auto-close timer while the pointer is over the toast. Defaults to True. |
| - draggable | Boolean | Allow the toast to be swiped away. By default it can be swiped on touch screens only; pass True to allow dragging with a mouse as well. |
| - loading | Boolean | Show a spinner and keep the toast open until it is updated. Defaults to False. |
| - id | String | Your own id for the toast. One is generated if omitted. |
| - sessionId | String | The session to show the toast in. Required from Gateway scripts. |
| - pageId | String | The page to show the toast on. Required from Gateway scripts. |
Returns
toastId String: The toast's id. Pass it to update or dismiss.
Example
# Simple toast from a Perspective script
system.kanoa.toast.show({"message": "Lot 123 released", "type": "success"})
# Toast with a title that stays open until the user closes it
system.kanoa.toast.show({
"title": "Line 1 stopped",
"message": "Material shortage at the filler",
"type": "warning",
"autoClose": 0
})
# From a Gateway script (for example, a tag change script)
system.kanoa.toast.show({
"message": "Batch complete",
"type": "info",
"sessionId": sessionId,
"pageId": pageId
})
# Loading toast, updated when the work finishes
toastId = system.kanoa.toast.show({"message": "Releasing lot 123...", "loading": True})