scottohara/tvmanager — Issue #32: Append all list items in one go
Author: scottohara
Created: 2011-12-22 22:46:43+00:00
State: open
Labels: Improvement

In list.js, we create
objects in a for loop; and append each one to the container (

) as we go.

For performance reasons, it would be better to generate all the
items; but then append them all at once at the of the loop (so that we're only updating the DOM once)

This would have an impact on the populateItemEventHander() (used by the episodes controller to automatically update the scroll position to the first unwatched entry as we go); as it would need to simply store the episode.id of the last unwatched. A subsequent step in the episodes controller itself, after the episodesList.refresh() call in activate() would then scroll to the position of the stored episode.id.

That's two performance gains for the price of one: only update the DOM once, and only update the scroll position once.