Now that we have the nice logic of lazy loading in place, let's take a look at what happens here under the hood.
.autorun() function , which we created earlier, will run the first time the code gets executed, subscribing us to the
lazyload-posts publication. Meteor then sends the first two documents of the
Posts collection, as the
limit we first sent is
The next time we change the
lazyloadLimit session, it changes the subscription by changing the limit to the value we passed to the publication function.
Meteor then checks which documents exist in our client-side database in the background and requests to download the missing ones.
This will also work the other way when we decrease the session value. Meteor removes the ...