11import { createSnapshot , extractRefs , callOnceWithArg , walkGet , walkSet } from './utils'
22
3- function unsubscribeAll ( subs ) {
3+ function unsubscribeAll ( subs ) {
44 for ( const sub in subs ) {
55 subs [ sub ] . unsub ( )
66 }
@@ -9,7 +9,7 @@ function unsubscribeAll(subs) {
99// NOTE not convinced by the naming of subscribeToRefs and subscribeToDocument
1010// first one is calling the other on every ref and subscribeToDocument may call
1111// updateDataFromDocumentSnapshot which may call subscribeToRefs as well
12- function subscribeToRefs ( { subs, refs, target, path, data, depth, ops, resolve } , options ) {
12+ function subscribeToRefs ( { subs, refs, target, path, data, depth, ops, resolve } , options ) {
1313 const refKeys = Object . keys ( refs )
1414 const missingKeys = Object . keys ( subs ) . filter ( refKey => refKeys . indexOf ( refKey ) < 0 )
1515 // unbind keys that are no longer there
@@ -22,7 +22,7 @@ function subscribeToRefs({ subs, refs, target, path, data, depth, ops, resolve }
2222 let resolvedCount = 0
2323 const totalToResolve = refKeys . length
2424 const validResolves = Object . create ( null )
25- function deepResolve ( key ) {
25+ function deepResolve ( key ) {
2626 if ( key in validResolves ) {
2727 if ( ++ resolvedCount >= totalToResolve ) resolve ( path )
2828 }
@@ -50,16 +50,16 @@ function subscribeToRefs({ subs, refs, target, path, data, depth, ops, resolve }
5050 path : docPath ,
5151 depth,
5252 ops,
53- resolve : deepResolve . bind ( null , docPath ) ,
53+ resolve : deepResolve . bind ( null , docPath )
5454 } ,
5555 options
5656 ) ,
57- path : ref . path ,
57+ path : ref . path
5858 }
5959 } )
6060}
6161
62- export function bindCollection (
62+ export function bindCollection (
6363 { vm, key, collection, ops, resolve, reject } ,
6464 options = { maxRefDepth : 2 }
6565) {
@@ -92,7 +92,7 @@ export function bindCollection(
9292 path : newIndex ,
9393 depth : 0 ,
9494 ops,
95- resolve : resolve . bind ( null , doc ) ,
95+ resolve : resolve . bind ( null , doc )
9696 } ,
9797 options
9898 )
@@ -117,7 +117,7 @@ export function bindCollection(
117117 target : array ,
118118 path : newIndex ,
119119 depth : 0 ,
120- resolve,
120+ resolve
121121 } ,
122122 options
123123 )
@@ -127,7 +127,7 @@ export function bindCollection(
127127 ops . remove ( array , oldIndex )
128128 // array.splice(oldIndex, 1)
129129 unsubscribeAll ( arraySubs . splice ( oldIndex , 1 ) [ 0 ] )
130- } ,
130+ }
131131 }
132132
133133 const unbind = collection . onSnapshot ( ref => {
@@ -171,7 +171,7 @@ export function bindCollection(
171171 }
172172}
173173
174- function updateDataFromDocumentSnapshot (
174+ function updateDataFromDocumentSnapshot (
175175 { snapshot, target, path, subs, ops, depth = 0 , resolve } ,
176176 options = { maxRefDepth : 2 }
177177) {
@@ -188,13 +188,13 @@ function updateDataFromDocumentSnapshot(
188188 path,
189189 ops,
190190 depth,
191- resolve,
191+ resolve
192192 } ,
193193 options
194194 )
195195}
196196
197- function subscribeToDocument ( { ref, target, path, depth, resolve, ops } , options ) {
197+ function subscribeToDocument ( { ref, target, path, depth, resolve, ops } , options ) {
198198 const subs = Object . create ( null )
199199 const unbind = ref . onSnapshot ( doc => {
200200 if ( doc . exists ) {
@@ -206,7 +206,7 @@ function subscribeToDocument({ ref, target, path, depth, resolve, ops }, options
206206 ops,
207207 subs,
208208 depth,
209- resolve,
209+ resolve
210210 } ,
211211 options
212212 )
@@ -234,7 +234,7 @@ function subscribeToDocument({ ref, target, path, depth, resolve, ops }, options
234234 * @param {OperationsType<any> } ops
235235 * @param {* } options
236236 */
237- export function bindDocument ( { vm, key, document, resolve, reject, ops } , options ) {
237+ export function bindDocument ( { vm, key, document, resolve, reject, ops } , options ) {
238238 // TODO warning check if key exists?
239239 // const boundRefs = Object.create(null)
240240
@@ -252,7 +252,7 @@ export function bindDocument({ vm, key, document, resolve, reject, ops }, option
252252 path : key ,
253253 subs,
254254 ops,
255- resolve,
255+ resolve
256256 } ,
257257 options
258258 )
0 commit comments