See the 2022 Blockly Developer Summit site here.

Namespace: dialog

Methods

alert

static

alert(message, opt_callback)

Wrapper to window.alert() that app developers may override via setAlert to provide alternatives to the modal browser window.

Parameter

message

string

The message to display to the user.

opt_callback

Optional

function()

The callback when the alert is dismissed.

confirm

static

confirm(message, callback)

Wrapper to window.confirm() that app developers may override via setConfirm to provide alternatives to the modal browser window.

Parameter

message

string

The message to display to the user.

callback

function(boolean)

The callback for handling user response.

Value must not be null.

prompt

static

prompt(message, defaultValue, callback)

Wrapper to window.prompt() that app developers may override via setPrompt to provide alternatives to the modal browser window. Built-in browser prompts are often used for better text input experience on mobile device. We strongly recommend testing mobile when overriding this.

Parameter

message

string

The message to display to the user.

defaultValue

string

The value to initialize the prompt with.

callback

function(nullable string)

The callback for handling user response.

Value must not be null.

setAlert

static

setAlert(alertFunction)

Sets the function to be run when Blockly.dialog.alert() is called.

Parameter

alertFunction

function(string, optional function())

The function to be run.

Value must not be null.

See also
Blockly.dialog.alert

setConfirm

static

setConfirm(confirmFunction)

Sets the function to be run when Blockly.dialog.confirm() is called.

Parameter

confirmFunction

function(string, non-null function(boolean))

The function to be run.

Value must not be null.

See also
Blockly.dialog.confirm

setPrompt

static

setPrompt(promptFunction)

Sets the function to be run when Blockly.dialog.prompt() is called.

Parameter

promptFunction

function(string, string, non-null function(nullable string))

The function to be run.

Value must not be null.

See also
Blockly.dialog.prompt