Closed matthew-andrews closed 10 years ago
I'd say this is required as otherwise the teardown for the currently active state wouldn't get run.
If this teardown function had logic like window.removeEventListener, it would never get run and you'd end up with zombie callbacks firing after the view had been destroyed.
Am I missing something...?
I suppose we do still need to call the run('teardown', { on: name });
... @wilsonpage the big reason for removing this was the module.el.classList.remove(name);
, so as every fruit module was torn down they amended their classes. This was causing quite a bit of layout thrashing...
So I suppose I should separate this into dom/event-type processing? We always want to tear down events - do we ever want to tear down the dom in this helper?
Ahh, ok. I don't think it makes sense to remove the last active class then. I think those classes serve the same purpose as media queries, so I guess don't remove them when the view is fully torndown, only when moving between breakpoints.
Addressed by pull request #2. Thanks Wilson :)
Hi @wilsonpage - we're discussing in a private issue about whether this line: https://github.com/ftlabs/fruitmachine-media/blob/master/media.js#L71 is necessary.
@rowanbeentje says:
I'm concerned that as I don't know the code that well that we might be missing something....