forresto / turtle-svg

JavaScript turtle graphics to SVG for laser cutting = LASER TURTLES!!!
http://forresto.github.com/turtle-svg/
26 stars 8 forks source link

svg loading feedback and abortion control #7

Closed craftoid closed 11 years ago

craftoid commented 11 years ago

Most of the calculation time is spend rendering/loading the SVG. Unfortunately aborting SVG loading once it started is not possible.

Rewriting the URL while it is being loaded would result in undefined behaviour, probably even locking the browser.

To prevent this from happening at all, we check if the SVG is loaded before starting the turtle worker inside the testCode function.

craftoid commented 11 years ago

The callback was just to introduce a little bit of model/view separation. So the code that loads the SVG is independent from the one that switches the state of the buttons...