lukehaas / RunJS

RunJS is a JavaScript playground for macOS, Windows and Linux. Write code with instant feedback and access to Node.js and browser APIs.
https://runjs.app
2.01k stars 43 forks source link

Runs previous code immediately after Start #529

Closed elhadjx closed 1 year ago

elhadjx commented 1 year ago

I was writing this code and I forgot the await before sleep and couldn't change, whenever i close/reopen RunJS it immediately starts running the code and I cant use RunJS until I kill the RunJS process from Task Manager `function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); }

function openlink(URL){ window.open(URL, '_blank'); }

async function demo() { for (let i = 0; i < 10; i++) { sleep(10000) openlink('https://github.com/elhadjx') } }

demo();`

elhadjx commented 1 year ago

it'd be better to run make the start runnable until a change happen after starting RunJS

lukehaas commented 1 year ago

Thanks, @elhadjx. You can disable auto-run from the preferences:

Screenshot 2023-01-27 at 16 19 41

lukehaas commented 1 year ago

I cant use RunJS until I kill the RunJS process from Task Manager

There's no need to kill RunJS from the Task Manager. Just click on Kill in the action menu: Screenshot 2023-01-27 at 16 21 19

elhadjx commented 1 year ago

The Autorun is helpful and it's why I'm using this software, except when it runs after start the software. The Kill on the action menu is helpful! thanks for answering this.

lukehaas commented 1 year ago

When auto-run is enabled, the expectation is that RunJS will always auto-run the code. This includes after starting the software.