Menu

Stop, Kill and loop protection
📰

Stop, Kill and loop protection

DEV Community: javascript·JSLab·9 days ago
#5ZxJ6B06
#devtojavascript#devto#dev#jslab#loop
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.