Skip to main content

Class: Toast

Defined in: packages/blockly/core/toast.ts:55

Class that allows for showing and dismissing temporary notifications.

Methods index​

MethodDescription
showShows a toast notification.
createDomCreates the DOM representation of a toast.
hideDismiss a toast, e.g. in response to a user action.

Constructors​

Constructor​

new Toast(): Toast;

Returns​

Toast

Methods​

show()​

static show(workspace, options): void;

Defined in: packages/blockly/core/toast.ts:65

Shows a toast notification.

Parameters​

ParameterTypeDescription
workspaceWorkspaceSvgThe workspace to show the toast on.
optionsToastOptionsConfiguration options for the toast message, duration, etc.

Returns​

void


createDom()​

protected static createDom(workspace, options): HTMLDivElement;

Defined in: packages/blockly/core/toast.ts:89

Creates the DOM representation of a toast.

Parameters​

ParameterTypeDescription
workspaceWorkspaceSvgThe workspace to inject the toast notification onto.
optionsToastOptionsConfiguration options for the toast.

Returns​

HTMLDivElement

The root DOM element of the toast.


hide()​

static hide(workspace, id?): void;

Defined in: packages/blockly/core/toast.ts:182

Dismiss a toast, e.g. in response to a user action.

Parameters​

ParameterTypeDescription
workspaceWorkspaceSvgThe workspace to dismiss a toast in.
id?stringThe toast ID, or undefined to clear any toast.

Returns​

void