How do i access Blockly events?

Hello
Is it possible to access the blockly log? I need to capture the events that occur in the block editor

Yes, you can attach a listener to the Blockly workspace to get events. It's probably easier to do this on the Javascript side.

already solved the problem. I use this post to ask a new question.

Is it possible from Blockly to access the values of the properties of the components? I can access to the list of components with Blockly.mainWorkspace.componentDb_.instances_ , but I can't find the way to access to the property values of each one of those components

Yes, you can do that if you have a newish version of master. You can call BlocklyPanel_getComponentInstancePropertyValue from the Blockly code. It takes a screen name, instance name, and property name and returns the value of the property as a string.


First of all, thank you very much for your answers. I have identified this function, but when I try to run it from the chrome console, it gives an error. Can't it be called from the javascript console of the browser?

Thanks in advance for your answer

Yes. Note that the screen name the fully qualified screen name, which is the project ID, an underscore, and then the screen name, e.g., "1234567890_Screen1". As an example, you could do the following:

BlocklyPanel_getComponentInstancePropertyValue(Blockly.mainWorkspace.formName, "Screen1", "AppName");

Amazing, thanks for your help! one last thing...to capture the user name I used jquery and got it directly from the html elements...isn't it stored in some variable?

When I finish my research work, I hope I can share my results with everyone

Yes, but it wouldn't be easy to access. Using the HTML is probably your best option.