コード例 #1
0
 public static IObservable <IDocumentSnapshot> AsObservable(this IDocumentReference document, bool includeMetadataChanges)
 {
     return(Observable.Create <IDocumentSnapshot>(observer =>
     {
         return document.AddSnapshotListener(includeMetadataChanges, (snapshot, error) =>
         {
             if (error != null)
             {
                 observer.OnError(error);
             }
             else
             {
                 observer.OnNext(snapshot !);
             }
         });
     }));
 }
        public static IObservable <IDocumentSnapshot> AsObservable(this IDocumentReference document)
        {
            return(Observable.Create <IDocumentSnapshot>(observer =>
            {
                var registration = document.AddSnapshotListener((snapshot, error) =>
                {
                    if (error != null)
                    {
                        observer.OnError(error);
                    }
                    else
                    {
                        observer.OnNext(snapshot);
                    }
                });

                return Disposable.Create(registration.Remove);
            }));
        }