JSCAD User Group
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Apr 11, 2017

    Scheduled Pinned Locked Moved Archives (Google+)
    1 Posts 1 Posters 1.0k Views 1 Watching
    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.
    • z3devZ Offline
      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

      Hello! It looks like you're interested in this conversation, but you don't have an account yet.

      Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

      With your input, this post could be even better 💗

      Register Login
      • First post
        Last post
      Powered by NodeBB | Contributors