Skip to content

Instantly share code, notes, and snippets.

@PatrickJS
Created July 7, 2014 00:34
Show Gist options
  • Save PatrickJS/edecde38f7f530364556 to your computer and use it in GitHub Desktop.
Save PatrickJS/edecde38f7f530364556 to your computer and use it in GitHub Desktop.
Polling for row updates
function getRowUpdates(row) {
var scrolls = Rx.Observable.fromEvent(document, 'scroll');
var rowVisibilities =
scrolls.throttle(50)
.map(function(scrollEvent) {
return row.isVisible(scrollEvent.offset);
})
.distinctUntilChanged();
var rowShows = rowrowVisibilities.filter(function(v) {
return v;
});
var rowHides = rowrowVisibilities.filter(function(v) {
return !v;
});
return rowShows
.flatMap(Rx.Observable.interval(10))
.flatMap(function() {
return row.getRowData().takeUntil(rowHides);
})
.toArray();
}
@iBasit
Copy link

iBasit commented Feb 21, 2016

I been looking for this example, thanks for posting, but Can you explain how this works. I mean, how I can fetch api data or huge list of data and put it on scroll...?

I'm also bid confused on how it will take rowHides and rowShow? is there event for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment