Skip to content

Commit

Permalink
Throttle rows
Browse files Browse the repository at this point in the history
(cherry picked from commit 0af1416)
  • Loading branch information
oparoz committed Feb 12, 2016
1 parent a8d0c35 commit 52a89f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/galleryview.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@
// 2 windows worth of rows is the limit from which we need to start loading new rows.
// As we scroll down, it grows
var targetHeight = ($(window).height() * 2) + scroll;
var showRows = function (album) {
var showRows = _.throttle(function (album) {

// If we've reached the end of the album, we kill the loader
if (!(album.viewedItems < album.subAlbums.length + album.images.length)) {
Expand Down Expand Up @@ -185,7 +185,7 @@
// Something went wrong, so kill the loader
view.loadVisibleRows.loading = null;
});
};
}, 100);
if (this.element.height() < targetHeight) {
this.loadVisibleRows.loading = true;
this.loadVisibleRows.loading = showRows(album);
Expand Down

0 comments on commit 52a89f2

Please sign in to comment.