Blockly.JavaScript.variableDB_ is not defined

153 views
Skip to first unread message

Julian

unread,
Sep 10, 2019, 3:21:20 AM9/10/19
to Blockly
Hey guys,

my app is crashing since yesterday. There was no blockly-version update or something like that. But suddenly this error appears in my customblocks for variable-blocks.

Error: Cannot read property 'getName' of undefined 

Line: var variable_vartitle = Blockly.JavaScript.variableDB_.getName(
        block.getFieldValue("varTitle"),
        Blockly.Variables.NAME_TYPE
      );

This means Blockly.JavaScript.variableDB_ ist not defined anymore. Does anybody had this kind of problems before?

Thank you.




Julian

unread,
Sep 10, 2019, 3:43:01 AM9/10/19
to Blockly
Ah and to be clear. Blockly.JavaScript is defined but not Blockly.JavaScript.variableDB_ anymore.

Neil Fraser

unread,
Sep 10, 2019, 5:46:56 AM9/10/19
to blo...@googlegroups.com
Blockly.JavaScript.variableDB_ doesn't appear until after JavaScript has been generated.  I don't think there has been any change in this in years.  Does this help?

--
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/3056dfa8-012b-47bf-872f-5d371d78d0b4%40googlegroups.com.


--

Julian

unread,
Sep 10, 2019, 6:43:39 AM9/10/19
to Blockly
Thanks for this fast response. The error appears when i try to run the code. So do I have to use a Blockly.JavaScript-Function before run the code?


On Tuesday, September 10, 2019 at 11:46:56 AM UTC+2, Neil Fraser wrote:
Blockly.JavaScript.variableDB_ doesn't appear until after JavaScript has been generated.  I don't think there has been any change in this in years.  Does this help?

On Tue, 10 Sep 2019 at 00:43, Julian <julian...@gmail.com> wrote:
Ah and to be clear. Blockly.JavaScript is defined but not Blockly.JavaScript.variableDB_ anymore.

On Tuesday, September 10, 2019 at 9:21:20 AM UTC+2, Julian wrote:
Hey guys,

my app is crashing since yesterday. There was no blockly-version update or something like that. But suddenly this error appears in my customblocks for variable-blocks.

Error: Cannot read property 'getName' of undefined 

Line: var variable_vartitle = Blockly.JavaScript.variableDB_.getName(
        block.getFieldValue("varTitle"),
        Blockly.Variables.NAME_TYPE
      );

This means Blockly.JavaScript.variableDB_ ist not defined anymore. Does anybody had this kind of problems before?

Thank you.




--
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 blo...@googlegroups.com.

Neil Fraser

unread,
Sep 10, 2019, 7:03:23 AM9/10/19
to blo...@googlegroups.com
I'm not sure what your code is doing, but here's the sequence I see on my console:

> Blockly.JavaScript.variableDB_
< undefined

> Blockly.JavaScript.workspaceToCode(Blockly.getMainWorkspace())
< "..."

> Blockly.JavaScript.variableDB_
< Blockly.Names {variablePrefix_: "", reservedDict_: {…}, db_: {…}, dbReverse_: {…}, variableMap_: null}

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/6d4d2298-3cfb-489f-ac6b-e7250764a85f%40googlegroups.com.

Julian

unread,
Sep 10, 2019, 7:09:24 AM9/10/19
to Blockly
Thanks a lot. I think I will be fine from here.

Reply all
Reply to author
Forward
0 new messages