Difference between Workspace and WorkspaceSvg

195 views
Skip to first unread message

Prabakar Puvanathasan

unread,
May 1, 2018, 11:23:40 AM5/1/18
to Blockly
Hi,

What is the difference between Workspace (https://developers.google.com/blockly/reference/js/Blockly.Workspace) and WorkspaceSvg (https://developers.google.com/blockly/reference/js/Blockly.WorkspaceSvg) instances? Can I get one instance from the other?


thank you

Prabakar Puvanathasan

unread,
May 1, 2018, 12:48:27 PM5/1/18
to Blockly
Sorry, I forgot to add the following to the question. When we inject into blockly via, Blockly.inject(), it returns a workspace instance. This instance is of type Blockly.Workspace. How can I get the associated Blockly.WorkspaceSvg instance?

thank you

Andrew n marshall

unread,
May 1, 2018, 1:25:53 PM5/1/18
to blo...@googlegroups.com
Blockly.inject() returns a WorkspaceSvg instance. WorkspaceSvg is a subclass of Workspace that includes all the HTML/SVG rendering necessary to present to the user. Workspace is the more limited superclass that does not include rendering and user interaction, and is ideal for running in a headless/server environment such as Node.js.

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Neil Fraser

unread,
May 1, 2018, 1:32:55 PM5/1/18
to blo...@googlegroups.com
An example of a headless Workspace is here: https://blockly-demo.appspot.com/static/demos/headless/index.html
There's no SVG visualization.  Any workspace you can see is a WorkspaceSvg.

prabakar

unread,
May 4, 2018, 12:09:31 AM5/4/18
to blo...@googlegroups.com
Thank you guys for clarifying it for me. I just realize that on the documentation it does mention WorkspaceSvg extends Workspace.
Reply all
Reply to author
Forward
0 new messages