dialog namespace
Functions
Function | Description |
---|---|
alert(message, opt_callback) | Wrapper to window.alert() that app developers may override via setAlert to provide alternatives to the modal browser window. |
confirm(message, callback) | Wrapper to window.confirm() that app developers may override via setConfirm to provide alternatives to the modal browser window. |
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. |
setAlert(alertFunction) | Sets the function to be run when Blockly.dialog.alert() is called. |
setConfirm(confirmFunction) | Sets the function to be run when Blockly.dialog.confirm() is called. |
setPrompt(promptFunction) | Sets the function to be run when Blockly.dialog.prompt() is called. **Important**: When overridding this, be aware that non-native prompt experiences may require managing ephemeral focus in FocusManager. This isn't needed for the native window prompt because it prevents focus from being changed while open. |
setToast(toastFunction) | Sets the function to be run when Blockly.dialog.toast() is called. |
toast(workspace, options) | Displays a temporary notification atop the workspace. Blockly provides a default toast implementation, but developers may provide their own via setToast. For simple appearance customization, CSS should be sufficient. |