Skip to content

Commit 99fa6b0

Browse files
bsafposva
authored andcommitted
Tweak README for Cloud Firestore (#154)
1 parent 567c7de commit 99fa6b0

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

Diff for: packages/vuexfire/README.md

+21-16
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ If you need an older version check the `v1` branch: `npm i -D vuexfire@v1`
1010
1. Using a CDN:
1111

1212
``` html
13-
<script src="https://unpkg.com/vuexfire"></script>
13+
<script src="https://unpkg.com/vuexfire@next"></script>
1414
```
1515

1616
2. In module environments, e.g CommonJS:
1717

1818
``` bash
19-
npm install vue firebase vuexfire --save
19+
npm install vue firebase vuexfire@next --save
2020
```
2121

2222
## Usage
@@ -74,7 +74,7 @@ const Component = {
7474
template: '<div>{{ todos }}</div>',
7575
computed: Vuex.mapState(['todos']),
7676
created () {
77-
this.$store.dispatch('setTodosRef', db.ref('todos'))
77+
this.$store.dispatch('setTodosRef', db.collection('todos'))
7878
}
7979
}
8080
```
@@ -89,10 +89,10 @@ support any of these browsers:
8989
- Android < 5.0
9090

9191
You'll have to include a polyfill. You can
92-
use [Benvie/WeakMap](https://github.com/Benvie/WeakMap)
92+
use [Benvie/WeakMap](https://github.com/Benvie/WeakMap).
9393

9494
You can find more information about `WeakMap`
95-
support [here](http://kangax.github.io/compat-table/es6/#test-WeakMap)
95+
support [here](http://kangax.github.io/compat-table/es6/#test-WeakMap).
9696

9797
## How does it work?
9898

@@ -104,7 +104,7 @@ it works with modules too :+1:
104104

105105
## Examples
106106

107-
You can check out the examples by opening the html files in your browser, or check [this online Demo](https://jsfiddle.net/posva/6w3ks04x/)
107+
You can check out a complete example in the `/examples` directory.
108108

109109
## API
110110

@@ -113,32 +113,37 @@ You can check out the examples by opening the html files in your browser, or che
113113
This object contains VuexFire internal mutations. They are all prefixed by
114114
`vuexfire/`. This object must be added in the root Store mutations object.
115115

116-
### bindFirebaseRef(key, ref[, options])
116+
### bindFirebaseRef(key, ref)
117117

118118
_Only available inside of an enhanced action_
119119

120120
Binds a firebase reference to a property in the state. If there was already
121121
another reference bound to the same property, it unbinds it first.
122122

123-
#### options:
124-
125123
```js
126-
{
127-
cancelCallback: Function, // Cancel callback passed to Firebase when listening for events
128-
readyCallback: Function, // Callback called once the data has been loaded. Useful for SSR
129-
errorCallback: Function, // Callback called when there is an error loading the data. Useful for SSR
130-
wait: Boolean, // (Arrays only) Should Vuexfire wait for the whole array to be populated. Defaults to true
131-
}
124+
bindFirebaseRef('todos', ref)
132125
```
133126

134-
`wait` can be set to true every time. It's useful to do pagination and SSR.
127+
Returns a promise which will resolve when the data is ready, or throw an error if something goes wrong:
128+
129+
```js
130+
bindFirebaseRef('todos', ref).then(() => {
131+
commit('setTodosLoaded', true)
132+
}).catch((err) => {
133+
console.log(err)
134+
})
135+
```
135136

136137
### unbindFirebaseRef(key)
137138

138139
_Only available inside of an enhanced action_
139140

140141
Unbinds a bound firebase reference to a given property in the state.
141142

143+
```js
144+
unbindFirebaseRef('todos')
145+
```
146+
142147
## License
143148

144149
[MIT](http://opensource.org/licenses/MIT)

0 commit comments

Comments
 (0)