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

    How do you single step your code?

    Scheduled Pinned Locked Moved Development Discussions
    4 Posts 3 Posters 1.8k 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.
    • David BoltD Offline
      David Bolt
      last edited by

      I just started using the JSCAD web version. As my files get bigger I would like to use the debugger and set breakpoints.

      When I open the inspector, I can see my file Under https://jscad.app/{unique id}

      but I can not set a breakpoint.

      I would rather not pepper my file with console.log statements.

      How do you single step your code?

      David Bolt
      David.Bolt@SFCknox.org

      platypiiP z3devZ 3 Replies Last reply Reply Quote 0
      • platypiiP Offline
        platypii @David Bolt
        last edited by

        @david-bolt this is kind of tricky right now, but @z3dev just merged a pull request which will make it much easier, soon.

        The problem is that chrome has a different set of break points for the Main Thread vs Web Workers. If you set a breakpoint on the main sources, it won't pause the debugger if that line of code is executed on a Web Worker. Which is a problem since JSCAD runs modeling in a worker.

        You could set the breakpoint in the worker sources. But the problem is that on the currently published version of JSCAD, it loads a NEW worker for each render. Which resets the breakpoints.

        @z3dev literally just merged a commit to master that retains the web worker, and I just tested locally, and it DOES enable you to step through:

        breakpoint.png

        So your options are:

        1. run locally and add console.log statements
        2. run locally and add debugger statements
        3. run locally latest version from master, and add breakpoints to Web Worker Sources
        4. wait for the next version to be cut (usually at least monthly), and then do (3) on the jscad website.
        1 Reply Last reply Reply Quote 0
        • platypiiP Offline
          platypii @David Bolt
          last edited by

          Actually, you can just put a debugger statement in your design, chrome will pause at it, and then you can step through it. Neat.

          1 Reply Last reply Reply Quote 1
          • z3devZ Offline
            z3dev @David Bolt
            last edited by

            @David-Bolt The latest release has a change which retains the webworker thread. So, debugging should be easier now.

            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