Skip to main content

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

- messageStringRequired. The toast's text, up to 1000 characters.
- titleStringOptional bold heading above the message, up to 1000 characters.
- typeStringinfo, success, warning, error or default (the default). Sets the color and icon.
- positionStringtop-left, top-center, top-right, bottom-left, bottom-center (the default) or bottom-right.
- animateStringThe entrance and exit animation: bounce (the default), slide, zoom or flip.
- autoCloseIntegerMilliseconds before the toast closes. 0 keeps it open until it is dismissed. Defaults to 5000.
- closeButtonBooleanShow the close button. Defaults to True.
- pauseOnHoverBooleanPause the auto-close timer while the pointer is over the toast. Defaults to True.
- draggableBooleanAllow 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.
- loadingBooleanShow a spinner and keep the toast open until it is updated. Defaults to False.
- idStringYour own id for the toast. One is generated if omitted.
- sessionIdStringThe session to show the toast in. Required from Gateway scripts.
- pageIdStringThe 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})