Navigation

    JSCAD User Group

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

    How do you single step your code?

    Development Discussions
    2
    3
    21
    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 Bolt
      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

      platypii 2 Replies Last reply Reply Quote 0
      • platypii
        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
        • platypii
          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
          • First post
            Last post
          Powered by NodeBB | Contributors