debugjs
debugjs copied to clipboard
How would this be built today?
Hey. I'm making a "learn to program" platform. https://tinkr,tech, if you're interested. It's kind of like Replit, but I'm focusing on making the very first steps on the journey as intuitive as possible. Part of that is executing slowly line-by-line.
I started with putting await new Promise(res => setTimeout(() => res(), 1000))
in between every line (video of it working). Functions break it of course, because they're not async
. Converting all functions to async
seems complicated and fragile. So now looking into yield, but then I need to go through the AST conversion and creating a stack, just like you have.
So my question is - if all you need is a 1sec delay between each JS line of code - how would you implement that today? Obviously we have yield now, but that probably doesn't change the need to go through AST and create a custom execution stack.