<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[How do you single step your code?]]></title><description><![CDATA[<p dir="auto">I just started using the JSCAD web version.  As my files get bigger I would like to use the debugger and set breakpoints.</p>
<p dir="auto">When I open the inspector, I can see my file Under <a href="https://jscad.app/" rel="nofollow ugc">https://jscad.app/</a>{unique id}</p>
<p dir="auto">but I can not set a breakpoint.</p>
<p dir="auto">I would rather not pepper my file with console.log statements.</p>
<p dir="auto">How do you single step your code?</p>
<p dir="auto">David Bolt<br />
<a href="mailto:David.Bolt@SFCknox.org" rel="nofollow ugc">David.Bolt@SFCknox.org</a></p>
]]></description><link>https://openjscad.nodebb.com/topic/370/how-do-you-single-step-your-code</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 02:50:06 GMT</lastBuildDate><atom:link href="https://openjscad.nodebb.com/topic/370.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 14 Jun 2022 15:14:41 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to How do you single step your code? on Fri, 22 Jul 2022 11:13:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/david-bolt" aria-label="Profile: David-Bolt">@<bdi>David-Bolt</bdi></a> The latest release has a change which retains the webworker thread. So, debugging should be easier now.</p>
]]></description><link>https://openjscad.nodebb.com/post/1226</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1226</guid><dc:creator><![CDATA[z3dev]]></dc:creator><pubDate>Fri, 22 Jul 2022 11:13:27 GMT</pubDate></item><item><title><![CDATA[Reply to How do you single step your code? on Wed, 15 Jun 2022 01:24:06 GMT]]></title><description><![CDATA[<p dir="auto">Actually, you can just put a <code>debugger</code> statement in your design, chrome will pause at it, and then you can step through it. Neat.</p>
]]></description><link>https://openjscad.nodebb.com/post/1209</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1209</guid><dc:creator><![CDATA[platypii]]></dc:creator><pubDate>Wed, 15 Jun 2022 01:24:06 GMT</pubDate></item><item><title><![CDATA[Reply to How do you single step your code? on Tue, 14 Jun 2022 18:26:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/david-bolt" aria-label="Profile: david-bolt">@<bdi>david-bolt</bdi></a> this is kind of tricky right now, but <a class="plugin-mentions-user plugin-mentions-a" href="/user/z3dev" aria-label="Profile: z3dev">@<bdi>z3dev</bdi></a> just merged a pull request which will make it much easier, soon.</p>
<p dir="auto">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.</p>
<p dir="auto">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.</p>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/z3dev" aria-label="Profile: z3dev">@<bdi>z3dev</bdi></a> literally just merged a <a href="https://github.com/jscad/OpenJSCAD.org/commit/80a85b018f39b837bfbb5278b180fd2568eef283" rel="nofollow ugc">commit</a> to master that retains the web worker, and I just tested locally, and it DOES enable you to step through:</p>
<p dir="auto"><img src="/assets/uploads/files/1655230916625-breakpoint.png" alt="breakpoint.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">So your options are:</p>
<ol>
<li>run locally and add <code>console.log</code> statements</li>
<li>run locally and add <code>debugger</code> statements</li>
<li>run locally latest version from master, and add breakpoints to Web Worker Sources</li>
<li>wait for the next version to be cut (usually at least monthly), and then do (3) on the jscad website.</li>
</ol>
]]></description><link>https://openjscad.nodebb.com/post/1208</link><guid isPermaLink="true">https://openjscad.nodebb.com/post/1208</guid><dc:creator><![CDATA[platypii]]></dc:creator><pubDate>Tue, 14 Jun 2022 18:26:01 GMT</pubDate></item></channel></rss>