@@ -39,7 +39,7 @@ function bindCollection ({
39
39
subs [ refKey ] = {
40
40
unbind : subscribeToDocument ( {
41
41
ref,
42
- obj : innerObj ,
42
+ target : innerObj ,
43
43
key : innerKey ,
44
44
depth,
45
45
// TODO parentSubs
@@ -79,10 +79,10 @@ function bindCollection ({
79
79
} , reject )
80
80
}
81
81
82
- function updateDataFromDocumentSnapshot ( { snapshot, obj , key, subs, depth = 0 , resolve } ) {
82
+ function updateDataFromDocumentSnapshot ( { snapshot, target , key, subs, depth = 0 , resolve } ) {
83
83
// TODO extract refs
84
84
const [ data , refs ] = extractRefs ( snapshot )
85
- obj [ key ] = data
85
+ target [ key ] = data
86
86
const refKeys = Object . keys ( refs )
87
87
if ( ! refKeys . length ) return resolve ( )
88
88
// TODO check if no ref is missing
@@ -96,11 +96,11 @@ function updateDataFromDocumentSnapshot ({ snapshot, obj, key, subs, depth = 0,
96
96
sub . unbind ( )
97
97
}
98
98
// 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 )
100
100
subs [ refKey ] = {
101
101
unbind : subscribeToDocument ( {
102
102
ref,
103
- obj : innerObj ,
103
+ target : innerObj ,
104
104
key : innerKey ,
105
105
depth,
106
106
// TODO parentSubs
@@ -115,20 +115,20 @@ function updateDataFromDocumentSnapshot ({ snapshot, obj, key, subs, depth = 0,
115
115
} )
116
116
}
117
117
118
- function subscribeToDocument ( { ref, obj , key, depth, resolve } ) {
118
+ function subscribeToDocument ( { ref, target , key, depth, resolve } ) {
119
119
const subs = Object . create ( null )
120
120
const unbind = ref . onSnapshot ( doc => {
121
121
if ( doc . exists ) {
122
122
updateDataFromDocumentSnapshot ( {
123
123
snapshot : createSnapshot ( doc ) ,
124
- obj ,
124
+ target ,
125
125
key,
126
126
subs,
127
127
depth,
128
128
resolve
129
129
} )
130
130
} else {
131
- obj [ key ] = null
131
+ target [ key ] = null
132
132
resolve ( )
133
133
}
134
134
} )
@@ -160,7 +160,7 @@ function bindDocument ({
160
160
if ( doc . exists ) {
161
161
updateDataFromDocumentSnapshot ( {
162
162
snapshot : createSnapshot ( doc ) ,
163
- obj : vm ,
163
+ target : vm ,
164
164
key,
165
165
subs,
166
166
resolve
0 commit comments