0

HTML/JavaScript termination of running script when click Done

Adrian Nelson 12 years ago updated 12 years ago 2
Hi, First of all what a great app! I am writing / prototyping some data compression algorithms (in JavaScript) and using the preview facility of the HTML file that is including many scripts. some of these take time to run and as results are output into the DOM as the algorithms run it is sometimes obvious that my test can stop. When I click the Done button to return from preview to the editor nothing happens until the scripts running in the preview window complete even though I have returned to the editor.

My suggestion (if it is possible) is that when the Done button is clicked in the preview window is to reset the HTML document in order to effectively cancel the currently running Javascript so that the editor can be used straight away.

Thanks again for a great app,
Adrian
It sounds like the JavaScript code is running on the main thread and blocking it, so there is not much I can do. 

Maybe you can use setTimeout() between the calls to your functions or something like that in your html file so that the app has a chance to interpret the touch on the Done button?
This is exactly what I did (sorry my description wasn't very clear above) - so the Done button can be pressed and it does return to the editor but the editor is unresponsive until (it would appear) that the script has finished running - at least that is my theory ;-) Thanks for your suggestion though.