Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a "Stop" button when running #20

Open
certik opened this issue Aug 17, 2022 · 6 comments
Open

Add a "Stop" button when running #20

certik opened this issue Aug 17, 2022 · 6 comments

Comments

@certik
Copy link
Contributor

certik commented Aug 17, 2022

If you make a mistake in the code and it does not finish quickly (say infinite loop or too large a loop), we need to add some button to be able to stop it.

One idea is to turn the Run button into a Stop button. Another idea is to make the Stop button to pop up next to it, and it will disappear when it finishes.

@faze-geek
Copy link

I have set up the website and successfully run it on my local machine. I will try this out soon.
I am thinking of a diff like this -

<div>
                <Button disabled={disabled} onClick={() => handleUserTabChange(activeTab)}> <PlayCircleOutlined /> Run </Button>
                <Button disabled={!disabled} onClick={() => {/* Add code to stop the execution here */}}> <PlayCircleOutlined /> Stop </Button>
</div>

Basically, The disabled prop of this button is set to the opposite of the Run button's disabled prop to ensure that it is only clickable when the program is running. Now I will need to add the code to stop the execution in the onClick event handler of this button.

@certik
Copy link
Contributor Author

certik commented Feb 24, 2023

Something like that, yes.

@diivi
Copy link

diivi commented Feb 27, 2023

When I start an infinite loop on the website, it becomes unresponsive and I can't click anything unless execution completes.

@faze-geek
Copy link

Yes, the unresponsiveness should be dealt with first. I didn't even need a infinite loop. Simply printing numbers upto 100 didn't fetch a response in the output terminal.

@certik
Copy link
Contributor Author

certik commented Feb 27, 2023

Let's say a long (or infinite) loop is running in WASM.

  • How can one stop the execution from JavaScript after pressing the Stop button and ensuring the button can be clicked if the UI is not responsive?
  • What are some techniques to ensure the GUI is responsive?
  • Is it possible to give the program N seconds to finish (say with N=3), and always kill it if it doesn't finish?
  • We can start with N=1, and if it times out, the user can then select a larger time out manually, in exchange for unresponsive UI (if there is no other way to deal with the unresponsiveness).

@diivi
Copy link

diivi commented Feb 27, 2023

One way to deal with unresponsiveness is using web workers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants