I'm training a neural network in the browser. I am considering calling a function that could run for an extended period (overnight), and I'd like to be able to terminate the function execution in a non-fatal way (so I don't lose my data) once I'm happy.
I'm looking for a general solution that would allow any looping function to terminate in its current state from the console or a ui element with minimal changes.
I've seen this question but mine is a bit different; it's now 2016 and we have webworkers and post message, which seem like they would provide the tools for a solution.