Skip to content

Commit

Permalink
add .select(n)
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Sep 18, 2012
1 parent 6c9f707 commit edff3b0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
6 changes: 5 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,11 @@

### Pager#show(n)

Select the `n`th page and `.render()`.
Select page `n`, `.render()`, and emit "show".

### Pager#select(n)

Select page `n` and `.render()`.

### Pager#render()

Expand Down
17 changes: 15 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,17 +80,30 @@ Pager.prototype.next = function(){
};

/**
* Select the `n`th page.
* Select the page `n`.
*
* @param {Number} n
* @return {Pager}
* @api public
*/

Pager.prototype.show = function(n){
this.select(n);
this.emit('show', n)
return this;
};

/**
* Select page `n` without emitting "show".
*
* @param {Number} n
* @return {Pager}
* @api public
*/

Pager.prototype.select = function(n){
this.current = n;
this.render();
this.emit('show', n)
return this;
};

Expand Down

0 comments on commit edff3b0

Please sign in to comment.