all files / firebase/modules/firestore/ DocumentChange.js

100% Statements 8/8
100% Branches 0/0
100% Functions 5/5
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42                                      1141× 1141× 1141× 1141×                              
/**
 * @flow
 * DocumentChange representation wrapper
 */
import DocumentSnapshot from './DocumentSnapshot';
 
import type Firestore from './';
import type { NativeDocumentChange } from './types';
 
/**
 * @class DocumentChange
 */
export default class DocumentChange {
  _document: DocumentSnapshot;
  _newIndex: number;
  _oldIndex: number;
  _type: string;
 
  constructor(firestore: Firestore, nativeData: NativeDocumentChange) {
    this._document = new DocumentSnapshot(firestore, nativeData.document);
    this._newIndex = nativeData.newIndex;
    this._oldIndex = nativeData.oldIndex;
    this._type = nativeData.type;
  }
 
  get doc(): DocumentSnapshot {
    return this._document;
  }
 
  get newIndex(): number {
    return this._newIndex;
  }
 
  get oldIndex(): number {
    return this._oldIndex;
  }
 
  get type(): string {
    return this._type;
  }
}