The user sets up the subscription and publication to take a postsLimit
Session variable as parameter.
The pagination helper takes care of changing the Session variable on click.
The template helper takes one argument: the name of the pagination.
Inside the template helper, you can use an if/else block to define the "load more" and "no more items" elements. The hasMore
variable is automatically set for you.
We create a new pagination object on the server.
The package should set up a posts
publication that takes a limit
parameter, and returns a cursor identical to the cursor taken as argument by the eachWithPagination
helper, except extended with that limit
parameter.
The package should also automatically subscribe to the posts
publication, using a postsLimit
session variable.
The contents of the if block are automatically assigned a click event handler that increments the postsLimit
session variable.
Optionally, the package could also reflect pagination changes in the URL: http://myapp.com/?posts-limit=15
.