mirror of
https://github.com/google/blockly.git
synced 2025-12-16 06:10:12 +01:00
fix: Rename Generator to CodeGenerator (#6585)
Stops collisions with ES6's Generator. The old Blockly.Generator still exists as a name, but is now deprecated.
This commit is contained in:
@@ -194,4 +194,3 @@ BlocklyDevTools.Analytics.sendQueued = function() {
|
||||
// stub
|
||||
this.LOG_TO_CONSOLE_ && console.log('Analytics.sendQueued');
|
||||
};
|
||||
|
||||
|
||||
@@ -373,7 +373,7 @@ Code.renderContent = function() {
|
||||
|
||||
/**
|
||||
* Attempt to generate the code and display it in the UI, pretty printed.
|
||||
* @param generator {!Blockly.Generator} The generator to use.
|
||||
* @param generator {!Blockly.CodeGenerator} The generator to use.
|
||||
*/
|
||||
Code.attemptCodeGeneration = function(generator) {
|
||||
var content = document.getElementById('content_' + Code.selected);
|
||||
@@ -388,7 +388,7 @@ Code.attemptCodeGeneration = function(generator) {
|
||||
|
||||
/**
|
||||
* Check whether all blocks in use have generator functions.
|
||||
* @param generator {!Blockly.Generator} The generator to use.
|
||||
* @param generator {!Blockly.CodeGenerator} The generator to use.
|
||||
*/
|
||||
Code.checkAllGeneratorFunctionsDefined = function(generator) {
|
||||
var blocks = Code.workspace.getAllBlocks(false);
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
|
||||
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.2.0'
|
||||
|
||||
|
||||
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
|
||||
@@ -15,9 +15,9 @@ class ViewController: UIViewController, WKUIDelegate {
|
||||
/// The name used to reference this iOS object when executing callbacks from the JS code.
|
||||
/// If this value is changed, it should also be changed in the `CODE_GENERATOR_BRIDGE_JS` file.
|
||||
fileprivate static let HOST_HTML = "Blockly/webview.html"
|
||||
|
||||
|
||||
@IBOutlet weak var webView: WKWebView!
|
||||
|
||||
|
||||
/// Additional setup after loading the UI NIB.
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
@@ -25,7 +25,7 @@ class ViewController: UIViewController, WKUIDelegate {
|
||||
// Do any additional setup after loading the view, typically from a nib.
|
||||
loadWebContent()
|
||||
}
|
||||
|
||||
|
||||
/// Load the root HTML page into the webview.
|
||||
func loadWebContent() {
|
||||
if let htmlUrl = Bundle.main.url(forResource: "webview", withExtension: "html",
|
||||
@@ -41,7 +41,7 @@ class ViewController: UIViewController, WKUIDelegate {
|
||||
runJavaScriptAlertPanelWithMessage message: String,
|
||||
initiatedByFrame frame: WKFrameInfo,
|
||||
completionHandler: @escaping () -> Void) {
|
||||
|
||||
|
||||
let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert)
|
||||
let title = NSLocalizedString("OK", comment: "OK Button")
|
||||
let ok = UIAlertAction(title: title, style: .default) { (action: UIAlertAction) -> Void in
|
||||
@@ -51,25 +51,25 @@ class ViewController: UIViewController, WKUIDelegate {
|
||||
present(alert, animated: true)
|
||||
completionHandler()
|
||||
}
|
||||
|
||||
|
||||
/// Handle window.confirm() with a native dialog.
|
||||
func webView(_ webView: WKWebView,
|
||||
runJavaScriptConfirmPanelWithMessage message: String,
|
||||
initiatedByFrame frame: WKFrameInfo,
|
||||
completionHandler: @escaping (Bool) -> Void) {
|
||||
|
||||
|
||||
let alert = UIAlertController(title: nil, message: message, preferredStyle: .alert)
|
||||
let closeAndHandle = { (okayed: Bool) in
|
||||
alert.dismiss(animated: true, completion: nil)
|
||||
completionHandler(okayed)
|
||||
}
|
||||
|
||||
|
||||
let okTitle = NSLocalizedString("OK", comment: "OK button title")
|
||||
let ok = UIAlertAction(title: okTitle, style: .default) { (action: UIAlertAction) -> Void in
|
||||
closeAndHandle(true)
|
||||
}
|
||||
alert.addAction(ok)
|
||||
|
||||
|
||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title")
|
||||
let cancel = UIAlertAction(title: cancelTitle, style: .default) {
|
||||
(action: UIAlertAction) -> Void in
|
||||
@@ -78,34 +78,33 @@ class ViewController: UIViewController, WKUIDelegate {
|
||||
alert.addAction(cancel)
|
||||
present(alert, animated: true)
|
||||
}
|
||||
|
||||
|
||||
/// Handle window.prompt() with a native dialog.
|
||||
func webView(_ webView: WKWebView,
|
||||
runJavaScriptTextInputPanelWithPrompt prompt: String,
|
||||
defaultText: String?,
|
||||
initiatedByFrame frame: WKFrameInfo,
|
||||
completionHandler: @escaping (String?) -> Void) {
|
||||
|
||||
|
||||
let alert = UIAlertController(title: prompt, message: nil, preferredStyle: .alert)
|
||||
|
||||
|
||||
alert.addTextField { (textField) in
|
||||
textField.text = defaultText
|
||||
}
|
||||
|
||||
|
||||
let okTitle = NSLocalizedString("OK", comment: "OK button title")
|
||||
let okAction = UIAlertAction(title: okTitle, style: .default) { (_) in
|
||||
let textInput = alert.textFields![0] as UITextField
|
||||
completionHandler(textInput.text)
|
||||
}
|
||||
alert.addAction(okAction)
|
||||
|
||||
|
||||
let cancelTitle = NSLocalizedString("Cancel", comment: "Cancel button title")
|
||||
let cancelAction = UIAlertAction(title: cancelTitle, style: .cancel) { (_) in
|
||||
completionHandler(nil)
|
||||
}
|
||||
alert.addAction(cancelAction)
|
||||
|
||||
|
||||
present(alert, animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user