Rich-Harris / ramjet

Morph DOM elements from one state to another with smooth animations and transitions

Home Page:http://www.rich-harris.co.uk/ramjet/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

done function - shouldn't it pass a,b as arguments?

bradparks opened this issue · comments

Hey! I was wondering if the done function should pass the a,b values that transform receives as arguments?

e.g.

options.done = function(a,b)
{
  console.log(a,b);
}

Sure this could be bound using .bind, but why the extra work if it can be passed in? Thanks!

It'd be easy enough to implement, definitely. Only thing is that it would mean that we couldn't then use the arguments to done for anything else, if we came up with a better use for them, so we'd need to be sure that it was worthwhile, especially since we've got .bind. Personally I've only ever used a closure for done...

var from = someNode;
var to = someOtherNode;

ramjet.transform( from, to, {
  done: function () {
    // we can already access `from` and `to` here...
    // no need to have them as arguments
  }
});

...so there's not much to be gained in that scenario. But I'd be interested to see examples where passing the arguments in would make life easier?

yeah, i think you're totally right... especially given the fact that maybe something else could be passed in laster on that might be more relevant... thanks again!