Apr 11, 2017
-
Tim Murphy
Newbie to OpenJSCAD. Love it. Could someone point me to tips for debugging my jscad scripts.I'm familiar with js, chrome, chrome developer tools. Tried to use the options for worker scripts (new to me). I can't get a breakpoint to work (the script seems to get replaced each run).
Any help would be appreciated.
5 comments
5
no plus ones
no shares
Shared publiclyJeff Gay The worker basically runs within another context, and that makes debugging difficult. And as you know, the worker is provided with the script (JSCAD script appended with others), parameters, library list, etc. Basically, the worker is a small instance of JS, which works within the scope of the parameters passed to it. No more. This eliminates security issues, but makes them almost useless.
Apr 12, 2017
Tim Murphy
OK. Thank you.Apr 12, 2017
Jeff Gay
Do you want to make some changes? We always welcome contributions.Apr 12, 2017
Ivaan Nazaroff
+1
If you put linedebugger;
into your script, and have the developer console open, you will trigger a break in the worker context. From there you can step in, step over, interrogate variables and run adhoc js in the context of the loaded libraries.
Apr 23, 2017
Tim Murphy
I been away from this for a while... Thank you both for your comments. +Ivaan Nazaroff The 'debugger;' thing was what I was missing. It's exactly what I was after. I'm fairly new to JS and wasn't aware of it.