all files / couch/couch/ changes.js

100% Statements 10/10
100% Branches 0/0
100% Functions 4/4
100% Lines 10/10
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 43 44 45 46 47 48                                                                           
import SuspendableChanges from './changes/suspendable-changes';
 
export default SuspendableChanges.extend({
 
  couch: null,
 
  _feedOptions() {
    let opts = this.get('opts');
 
    let {
      since,
      timeout,
      heartbeat,
      reconnect
    } = opts;
 
    let url = this.get('couch.url');
 
    return {
      url: `${url}/_db_updates`,
      since,
      reconnect,
      qs: {
        timeout,
        heartbeat
      }
    };
  },
 
  _feedContext() {
    let couch = this.get('couch');
    return {
      request: opts => couch._request(opts)
    };
  },
 
  _feedFactoryName(feed) {
    return `couch:couch-changes/feed/${feed}`;
  },
 
  willDestroy() {
    this.get('couch')._changesWillDestroy(this);
    this._super();
  }
 
});