JSLab feature notes: one docs page, explained. Today: Stop, Kill and loop protection , from The editor and live output.
JSLab, a JavaScript & TypeScript scratchpad for macOS, runs your code as you type it. Code you're typing is code that's half-written, and half-written code doesn't always end. This note covers what happens then.
A run can stay active on purpose
A run doesn't end when the last line runs. It stays active while it has open timers, servers, sockets or child processes, and the status bar says so:
let ticks = 0 ; const timer = setInterval (() => { ticks ++ ; console . log ( `tick ${ ticks } ` ); if ( ticks === 3 ) clearInterval ( timer ); }, 500 ); " started " ;
Enter fullscreen mode
Exit fullscreen mode
This one ends itself after three ticks. One that doesn't is what Stop is for.
Stop and Kill
⇧⌘R (Stop) stops a run gracefully and closes its timers, servers and the rest.…