Skip to content

Commit

Permalink
clarify basic usage
Browse files Browse the repository at this point in the history
also helps understand percolatestudio#58
  • Loading branch information
KristerV committed Oct 19, 2015
1 parent 65312fd commit 2e507cf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ Simply call `Counts.publish` within a publication, passing in a name and a curso
#### Example 1
##### JavaScript
```js
Meteor.publish('publication', function() {
Counts.publish(this, 'name-of-counter', Posts.find());
Meteor.publish('posts', function() {
Counts.publish(this, 'number-of-posts', Posts.find());
return Posts.find();
});
```

Expand All @@ -34,6 +35,8 @@ Meteor.publish 'publication', ->

The `Counts.publish` function returns the observer handle that's used to maintain the counter. You can call its `stop` method in order to stop the observer from running.

Make sure you `.find()` separately for the counter and publish return, otherwise you'll get an empty document.

For more info regarding the `options` parameter, see [Options](#options).

### Counts.get [client]
Expand Down

0 comments on commit 2e507cf

Please sign in to comment.