JSCAD User Group

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Apr 11, 2017

    Archives (Google+)
    1
    1
    773
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • z3dev
      z3dev last edited by

      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 publicly

      Jeff 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 line

      debugger;

      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.

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Powered by NodeBB | Contributors