jeremyckahn / shifty

The fastest TypeScript animation engine on the web
https://jeremyckahn.github.io/shifty/doc/
MIT License
1.54k stars 88 forks source link

Is calling dispose() mandatory? #86

Closed kimmobrunfeldt closed 8 years ago

kimmobrunfeldt commented 8 years ago

Hi,

Is calling .dispose() mandatory when I no longer need the tweenable object? Shouldn't GC automatically remove the tweenable object when references to the tweenable are gone. E.g.:


function tween() {
  var tweenable = new Tweenable();

  tweenable.tween({
    from: { a: 0 },
    to:   { a: 1 },
    duration: 500,
    easing: 'easeOutQuad',
    step: function(state) {
      // do stuff
    }
  });

  // tweenable should be cleaned after function call
}

tween()
jeremyckahn commented 8 years ago

Hi @kimmobrunfeldt, calling dispose is not mandatory, generally speaking. I mainly added that method so that it could be inherited and overridden if necessary by objects that extend Tweenable. I felt that a base object should provide some form of a cleanup method. If removing it fixes https://github.com/kimmobrunfeldt/progressbar.js/issues/107, it should be safe to do so.

kimmobrunfeldt commented 8 years ago

Great, thanks for the quick reply!