File tree Expand file tree Collapse file tree 1 file changed +7
-13
lines changed
Expand file tree Collapse file tree 1 file changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -81,26 +81,20 @@ export function bindAsObject(
8181) {
8282 const key = 'value'
8383 const options = Object . assign ( { } , DEFAULT_OPTIONS , extraOptions )
84- const unsub = onValue (
84+
85+ const unsubscribe = onValue (
8586 document ,
8687 ( snapshot ) => {
87- resolve ( snapshot )
88- unsub ( )
88+ const value = options . serialize ( snapshot )
89+ ops . set ( target , key , value )
90+ // resolve the promise
91+ resolve ( value )
8992 } ,
9093 reject
9194 )
92- // FIXME: Use only one onValue and
93- const listener = onValue (
94- document ,
95- ( snapshot ) => {
96- ops . set ( target , key , options . serialize ( snapshot ) )
97- }
98- // TODO: allow passing a cancel callback
99- // cancelCallback
100- )
10195
10296 return ( reset ?: ResetOption ) => {
103- listener ( )
97+ unsubscribe ( )
10498 if ( reset !== false ) {
10599 const value = typeof reset === 'function' ? reset ( ) : null
106100 ops . set ( target , key , value )
You can’t perform that action at this time.
0 commit comments