In forms.js I used $(el).data("towtruckSomeKindOfValue", value) to store
node-specific data like the change in time.  This would remove the need for
per-element listeners.


On Mon, Sep 9, 2013 at 9:41 PM, Michael Marsh <notifications@github.com>wrote:

> In towtruck/videos.js:
>
> > +    };
> > +  };
> > +
> > +  function areTooFarApart (currentTime, lastTime) {
> > +    var secDiff = Math.abs(currentTime - lastTime);
> > +    var milliDiff = secDiff * 1000;
> > +    return milliDiff > TOO_FAR_APART;
> > +  }
> > +
> > +  session.on("close", unsetListeners);
> > +
> > +  function unsetListeners () {
> > +    var videos = $('video');
> > +    Object.keys(listeners).forEach(function (eventName) {
> > +      var listener = listeners[eventName];
> > +      if (listener instanceof Array) {
>
> Timeupdate had to be registered separately for each individual video since
> getTimeUpdater (now "makeTimeUpdater") closed over a variable that it used
> to keep track of the change in time. Once I generalize "listeners" as an
> list, de-registering everything will be much simpler.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/mozilla/towtruck/pull/696/files#r6256555>
> .
>