I am trying to complete the custom renderer codelab but I am stuck very early on.
I have completed up to the very end of the 3rd page of instructions where I should be able to "open the playground in your browser and drag out a repeat block. The resulting block looks close to normal, but with slightly different alignment than Geras or Thrasos."
However, I receive an error stating: "Uncaught TypeError: Class constructor Renderer cannot be invoked without 'new'"
and another one:
"Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received"
I followed the instructions:
1. Cloning the blockly repo and using the latest version of tests/playground.html.
2.Adding the 'tests/playgrounds/custom_renderer.js', to the head of the playground.html page (slightly different to the instructions which are out of date):
<script>
var BLOCKLY_BOOTSTRAP_OPTIONS = {
additionalScripts: [
'build/msg/en.js',
'tests/playgrounds/screenshot.js',
'node_modules/@blockly/dev-tools/dist/index.js',
'tests/playgrounds/custom_renderer.js',
],
}
</script>
3. Adding the following code to my "custom_renderer.js" file:
CustomRenderer = function(name) {
CustomRenderer.superClass_.constructor.call(this, name);
};
Blockly.utils.object.inherits(CustomRenderer,
Blockly.blockRendering.Renderer);
Blockly.blockRendering.register('custom_renderer', CustomRenderer);
4. Changing the line "renderer: 'custom_renderer'," as shown below:
toolbox: toolbox,
toolboxPosition: 'start',
renderer: 'custom_renderer',
zoom:
{
controls: true,
wheel: true,
startScale: 1.0,
maxScale: 4,
minScale: 0.25,
scaleSpeed: 1.1
}
I also updated my versions of npm and node.
Below is a screenshot of the errors: