Blockly. dialog
Wrapper functions around JS functions for showing alert/confirmation dialogs.
Methods
alert
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
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
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
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
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
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