-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Move alert/confirm/prompt to a new file, dialog.js #5457
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…to core/dialog.js
| * @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) { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
The basics
goog_modulegoog_moduleconversion guide
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.