Stay organized with collections
Save and categorize content based on your preferences.
blockly > dialog > alert
dialog.alert() function
Wrapper to window.alert() that app developers may override via setAlert to provide alternatives to the modal browser window.
Signature:
export declare function alert(message: string, opt_callback?: () => void): void;
Parameters
Parameter |
Type |
Description |
message |
string |
The message to display to the user. |
opt_callback |
() => void |
(Optional) The callback when the alert is dismissed. |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["`dialog.alert()` provides a way to display alert messages to the user, similar to the browser's built-in `window.alert()`."],["Developers can customize the alert behavior by overriding the `setAlert` function."],["The function takes the alert message as a required parameter and an optional callback function to execute after the alert is dismissed."]]],["The `dialog.alert()` function displays a message to the user, mimicking the behavior of `window.alert()`. It accepts a string `message` as input, which is the text shown to the user. Optionally, a callback function `opt_callback` can be provided, which is executed when the alert is dismissed. App developers can replace this function with a custom implementation using `setAlert`. The function does not return any value.\n"]]