@@ -39,7 +39,7 @@ function bindCollection ({
3939 subs [ refKey ] = {
4040 unbind : subscribeToDocument ( {
4141 ref,
42- obj : innerObj ,
42+ target : innerObj ,
4343 key : innerKey ,
4444 depth,
4545 // TODO parentSubs
@@ -79,10 +79,10 @@ function bindCollection ({
7979 } , reject )
8080}
8181
82- function updateDataFromDocumentSnapshot ( { snapshot, obj , key, subs, depth = 0 , resolve } ) {
82+ function updateDataFromDocumentSnapshot ( { snapshot, target , key, subs, depth = 0 , resolve } ) {
8383 // TODO extract refs
8484 const [ data , refs ] = extractRefs ( snapshot )
85- obj [ key ] = data
85+ target [ key ] = data
8686 const refKeys = Object . keys ( refs )
8787 if ( ! refKeys . length ) return resolve ( )
8888 // TODO check if no ref is missing
@@ -96,11 +96,11 @@ function updateDataFromDocumentSnapshot ({ snapshot, obj, key, subs, depth = 0,
9696 sub . unbind ( )
9797 }
9898 // maybe wrap the unbind function to call unbind on every child
99- const [ innerObj , innerKey ] = deepGetSplit ( obj [ key ] , refKey )
99+ const [ innerObj , innerKey ] = deepGetSplit ( target [ key ] , refKey )
100100 subs [ refKey ] = {
101101 unbind : subscribeToDocument ( {
102102 ref,
103- obj : innerObj ,
103+ target : innerObj ,
104104 key : innerKey ,
105105 depth,
106106 // TODO parentSubs
@@ -115,20 +115,20 @@ function updateDataFromDocumentSnapshot ({ snapshot, obj, key, subs, depth = 0,
115115 } )
116116}
117117
118- function subscribeToDocument ( { ref, obj , key, depth, resolve } ) {
118+ function subscribeToDocument ( { ref, target , key, depth, resolve } ) {
119119 const subs = Object . create ( null )
120120 const unbind = ref . onSnapshot ( doc => {
121121 if ( doc . exists ) {
122122 updateDataFromDocumentSnapshot ( {
123123 snapshot : createSnapshot ( doc ) ,
124- obj ,
124+ target ,
125125 key,
126126 subs,
127127 depth,
128128 resolve
129129 } )
130130 } else {
131- obj [ key ] = null
131+ target [ key ] = null
132132 resolve ( )
133133 }
134134 } )
@@ -160,7 +160,7 @@ function bindDocument ({
160160 if ( doc . exists ) {
161161 updateDataFromDocumentSnapshot ( {
162162 snapshot : createSnapshot ( doc ) ,
163- obj : vm ,
163+ target : vm ,
164164 key,
165165 subs,
166166 resolve
0 commit comments