Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Chau committed May 14, 2018
1 parent 2998431 commit 5bbc3db
Showing 1 changed file with 39 additions and 4 deletions.
43 changes: 39 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default {
}
```

#### Subscriptions
### Subscriptions

Add an object for each subscription in a `$subscribe` object. The object key is the name of the publication and the value is either an array of parameters or a function returning an array of parameters. These subscription will be stopped when the component is destroyed.

Expand Down Expand Up @@ -101,7 +101,7 @@ Vue.config.meteor.subscribe = function(...args) {
}
```

#### Reactive data
### Reactive data

You can add reactive properties that update from any Meteor reactive sources (like collections or session) by putting an object for each property in the `meteor` object. The object key is the name of the property (it shouldn't start with `$`), and the value is a function that returns the result.

Expand Down Expand Up @@ -166,7 +166,7 @@ computed: {
}
```

#### Activating and deactivating meteor data
### Activating and deactivating meteor data

You can deactivate and activate again the meteor data on the component with `this.$startMeteor` and `this.$stopMeteor`:

Expand Down Expand Up @@ -199,7 +199,7 @@ export default {
}
```

#### Freezing data
### Freezing data

This option will apply `Object.freeze` on the Meteor data to prevent Vue from setting up reactivity on it. This can improve the performance of Vue when rendering large collection lists for example. By default, this option is turned off.

Expand All @@ -208,6 +208,41 @@ This option will apply `Object.freeze` on the Meteor data to prevent Vue from se
Vue.config.meteor.freeze = true
```

### Without meteor option

**Not currently SSR-friendly**

With the special methods injected to the components, you can use reactive Meteor data without the `meteor` option:

```js
export default {
data () {
return {
limit: 5,
sort: true,
}
},

created () {
// Not SSR friendly (for now)
this.$subscribe('notes', () => [this.limit])
},

computed: {
notes () {
// Not SSR friendly (for now)
return this.$autorun(() => Notes.find({}, {
sort: { created: this.sort ? -1 : 1 },
}))
},

firstNote () {
return this.notes.length && this.notes[0]
},
},
}
```

### Components

**Vue 2+ only**
Expand Down

0 comments on commit 5bbc3db

Please # to comment.