How I Made JavaScript Execution Visual and Rewindable (DSA View View ππ)
ΠΠΏΠΈΡΠ°Π½ΠΈΠ΅ ΠΈ ΠΏΡΠΈΠΌΠ΅Π½Π΅Π½ΠΈΠ΅
DSA View View ΠΏΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ Π²ΠΈΠ·ΡΠ°Π»ΠΈΠ·ΠΈΡΠΎΠ²Π°ΡΡ Π²ΡΠΏΠΎΠ»Π½Π΅Π½ΠΈΠ΅ Π°Π»Π³ΠΎΡΠΈΡΠΌΠΎΠ², Π·Π°ΠΏΠΈΡΡΠ²Π°Ρ ΠΏΡΠΎΠΌΠ΅ΠΆΡΡΠΎΡΠ½ΡΠ΅ ΡΠΎΡΡΠΎΡΠ½ΠΈΡ ΠΊΠΎΠ΄Π° ΠΈ Π²ΠΎΡΠΏΡΠΎΠΈΠ·Π²ΠΎΠ΄Ρ ΠΈΡ Π² ΠΏΠΎΠ»ΡΠ·ΠΎΠ²Π°ΡΠ΅Π»ΡΡΠΊΠΎΠΌ ΠΈΠ½ΡΠ΅ΡΡΠ΅ΠΉΡΠ΅, ΡΡΠΎ ΠΎΠ±Π»Π΅Π³ΡΠ°Π΅Ρ ΠΏΠΎΠ½ΠΈΠΌΠ°Π½ΠΈΠ΅ ΡΠΈΠΊΠ»ΠΎΠ², ΡΠ΅ΠΊΡΡΡΠΈΠΈ ΠΈ ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ ΠΏΠ΅ΡΠ΅ΠΌΠ΅Π½Π½ΡΡ .
ΠΠ°Π΄Π°ΡΠ°
Frontend developers studying data structures and algorithms need to see the intermediate state of their code, not just the final result, to understand loops, pointers, recursion, and variable changes.
Π Π΅Π·ΡΠ»ΡΡΠ°Ρ
DSA View View enables developers to visualize the execution of their algorithms, providing a rewindable timeline of variable states and function calls without affecting the original program logic.
Π Π°Π±ΠΎΡΠΈΠΉ ΠΏΡΠΎΡΠ΅ΡΡ
- Parse user TypeScript with Babel parser
- AST visitors inject recordStep calls into relevant nodes
- Transform TypeScript to JavaScript with Babel
- Run instrumented code inside a Web Worker using new Function
- Collect ExecutionStep objects during execution
- Send ExecutionState (steps array, totalSteps, etc.) to main thread via postMessage
- React UI updates currentStep and renders corresponding snapshot
- User can pause, step forward/backward, or jump to a variable change point
ΠΠΎΠΊΠ°Π·Π°ΡΠ΅Π»ΡΡΡΠ²Π°
Before execution, DSA View View rewrites the code into a version that can record its intermediate state, then runs it until it completes or reaches a configured limit.
The Runtime runs inside a dedicated Web Worker instead of the main thread.
- ΠΠ°ΡΠ° Π·Π°ΠΏΠΈΡΠΈ: 2026-09-07T22:44:29.763Z