Skip to content

Conversation

@gonfunko
Copy link
Contributor

The basics

  • I branched from goog_module
  • My pull request is against goog_module
  • My code follows the style guide
  • My code is presented in the form suggested in the module
    conversion guide
  • I have run npm test.

The details

Resolves

Part of #5208

Proposed Changes

This PR moves Blockly.alert/confirm/prompt into a new Blockly.dialog namespace in core/dialog.js. It also migrates uses in core to use Blockly.dialog.* instead of Blockly.*, and adds (deprecated) setters and getters under the old name in Blockly for backwards compatibility.

@gonfunko gonfunko requested a review from a team as a code owner September 13, 2021 19:55
@google-cla google-cla bot added the cla: yes Used by Google's CLA checker. label Sep 13, 2021
@github-actions github-actions bot added this to the 2021_q3_release milestone Sep 13, 2021
* @param {string} message The message to display to the user.
* @param {function()=} opt_callback The callback when the alert is dismissed.
*/
const alert = function(message, opt_callback) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why create a wrapper here, instead of just doing exports.alert = alertImplementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because that exports the initial value of alertImplementation, so even if alertImplementation gets modified via the setter, the initial/default implementation will continue to be used.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, that makes sense.

The comment is no longer correct (for this and the others) because to override you would call setAlert rather than overriding alert.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the JSDoc to clarify, thanks!

@gonfunko gonfunko merged commit ce8e792 into RaspberryPiFoundation:goog_module Sep 14, 2021
@gonfunko gonfunko deleted the dialogs branch September 14, 2021 15:19
@gonfunko gonfunko mentioned this pull request Sep 14, 2021
33 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes Used by Google's CLA checker. type: cleanup

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants