meltingice / CamanJS

Javascript HTML5 (Ca)nvas (Man)ipulation
http://camanjs.com
BSD 3-Clause "New" or "Revised" License
3.56k stars 406 forks source link

Method to cancel rendering? #101

Open bebraw opened 11 years ago

bebraw commented 11 years ago

Hi,

I have set up a small UI with a bunch of sliders (effect per slider). They act as a rendering stack which is then evaluated using CamanJS. It is possible to switch each filter to some other. I render a preview each time a slider is altered or a filter is switched.

As evaluating the stack can take longer than switching an effect, there can be issues. It is possible rendering hasn't finished before it should render again. This can lead to errors at Renderer (Uncaught TypeError: Object # has no method 'processFn' ). As the rendering queue gets altered by the next rendering, it can leave some things in a bad state. In this case this.currentJob is simply undefined.

Would it be feasible to add some kind of a way to cancel an ongoing job? I think this help to deal with cases like this.