One thing that may not be obvious to folks who have created custom blocks and fields is that the mechanism for sub-classing existing Blockly classes has changed in v9.0.0 and the existing old mechanism will no longer work with v9. Unless I missed something, you can no longer define your classes as functions and use the Blockly.utils.object.inherits function to make your class a subclass of a Blockly class. You'll see various errors relating to superclass constructors and calls to superclass methods.
Basically, you will now need to use the ES6 class ... extends ... syntax to create your class and use the super keyword to call the superclass constructor and methods. That also means putting any methods that call superclass methods into the class declaration.
--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/3d34a79b-eab2-44c7-b3d4-656b7df5d1a5n%40googlegroups.com.
I want to upgrade Blockly core to 9.3.1, but I have a problem.
The code below worked fine in 8.0.4
Blockly.myMutator=function(a){Blockly.myMutator.superClass_.constructor.call(this,null);this.quarkNames_=a};
But I got the error message in 9.3.1
blockly_compressed.js:2107 Uncaught TypeError: Class constructor Icon$$module$build$src$core$icon cannot be invoked without 'new'
One thing that may not be obvious to folks who have created custom blocks and fields is that the mechanism for sub-classing existing Blockly classes has changed in v9.0.0 and the existing old mechanism will no longer work with v9. Unless I missed something, you can no longer define your classes as functions and use the Blockly.utils.object.inherits function to make your class a subclass of a Blockly class. You'll see various errors relating to superclass constructors and calls to superclass methods.
Basically, you will now need to use the ES6 class ... extends ... syntax to create your class and use the super keyword to call the superclass constructor and methods. That also means putting any methods that call superclass methods into the class declaration.