@@ -2260,6 +2260,7 @@ firebase.firestore.doc = (collectionPath: string, documentPath?: string): firest
22602260      get : ( )  =>  firebase . firestore . getDocument ( collectionPath ,  fIRDocumentReference . documentID ) , 
22612261      update : ( data : any )  =>  firebase . firestore . update ( collectionPath ,  fIRDocumentReference . documentID ,  data ) , 
22622262      delete : ( )  =>  firebase . firestore . delete ( collectionPath ,  fIRDocumentReference . documentID ) 
2263+       // onSnapshot: (callback: (doc: DocumentSnapshot) => void) => firebase.firestore.onSnapshot(fIRDocumentReference, callback) 
22632264    } ; 
22642265
22652266  }  catch  ( ex )  { 
@@ -2268,6 +2269,12 @@ firebase.firestore.doc = (collectionPath: string, documentPath?: string): firest
22682269  } 
22692270} ; 
22702271
2272+ // firebase.firestore.onSnapshot = (docRef: FIRDocumentReference, callback: (doc: DocumentSnapshot) => void): void => { 
2273+ //   docRef.addSnapshotListener((snapshot: FIRDocumentSnapshot, error: NSError) => { 
2274+ //     callback(new DocumentSnapshot(snapshot ? snapshot.documentID : null, !!snapshot, snapshot ? firebase.toJsObject(snapshot.data()) : null)); 
2275+ //   }) 
2276+ // }; 
2277+ 
22712278firebase . firestore . add  =  ( collectionPath : string ,  document : any ) : Promise < firestore . DocumentReference >  =>  { 
22722279  return  new  Promise ( ( resolve ,  reject )  =>  { 
22732280    try  { 
@@ -2411,11 +2418,7 @@ firebase.firestore.getCollection = (collectionPath: string): Promise<firestore.Q
24112418              const  docSnapshots : Array < firestore . DocumentSnapshot >  =  [ ] ; 
24122419              for  ( let  i  =  0 ,  l  =  snapshot . documents . count ;  i  <  l ;  i ++ )  { 
24132420                const  document : FIRDocumentSnapshot  =  snapshot . documents . objectAtIndex ( i ) ; 
2414-                 docSnapshots . push ( { 
2415-                   id : document . documentID , 
2416-                   exists : true , 
2417-                   data : ( )  =>  firebase . toJsObject ( document . data ( ) ) 
2418-                 } ) ; 
2421+                 docSnapshots . push ( new  DocumentSnapshot ( document . documentID ,  true ,  ( )  =>  firebase . toJsObject ( document . data ( ) ) ) ) ; 
24192422              } 
24202423              const  snap  =  new  QuerySnapshot ( ) ; 
24212424              snap . docSnapshots  =  docSnapshots ; 
@@ -2449,11 +2452,7 @@ firebase.firestore.getDocument = (collectionPath: string, documentPath: string):
24492452            if  ( error )  { 
24502453              reject ( error . localizedDescription ) ; 
24512454            }  else  { 
2452-               resolve ( { 
2453-                 id : snapshot  ? snapshot . documentID  : null , 
2454-                 exists : ! ! snapshot , 
2455-                 data : ( )  =>  snapshot  ? firebase . toJsObject ( snapshot . data ( ) )  : null 
2456-               } ) ; 
2455+               resolve ( new  DocumentSnapshot ( snapshot  ? snapshot . documentID  : null ,  ! ! snapshot ,  ( )  =>  snapshot  ? firebase . toJsObject ( snapshot . data ( ) )  : null ) ) ; 
24572456            } 
24582457          } ) ; 
24592458
@@ -2475,11 +2474,7 @@ firebase.firestore._getQuery = (collectionPath: string, query: FIRQuery): firest
24752474          const  docSnapshots : Array < firestore . DocumentSnapshot >  =  [ ] ; 
24762475          for  ( let  i  =  0 ,  l  =  snapshot . documents . count ;  i  <  l ;  i ++ )  { 
24772476            const  document : FIRDocumentSnapshot  =  snapshot . documents . objectAtIndex ( i ) ; 
2478-             docSnapshots . push ( { 
2479-               id : document . documentID , 
2480-               exists : true , 
2481-               data : ( )  =>  firebase . toJsObject ( document . data ( ) ) 
2482-             } ) ; 
2477+             docSnapshots . push ( new  DocumentSnapshot ( document . documentID ,  true ,  ( )  =>  firebase . toJsObject ( document . data ( ) ) ) ) ; 
24832478          } 
24842479          const  snap  =  new  QuerySnapshot ( ) ; 
24852480          snap . docSnapshots  =  docSnapshots ; 
0 commit comments