Code coverage report for src/components/bind-store-mixin.cjsx

Statements: 91.67% (22 / 24)      Branches: 73.68% (14 / 19)      Functions: 100% (7 / 7)      Lines: 91.67% (22 / 24)      Ignored: none     

All files » src/components/ » bind-store-mixin.cjsx
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     437×     842×     763× 763× 763× 561×   202×       437× 437× 437×     437× 437× 437×       405× 405×     405× 405× 405×       437×     405×        
var slice = [].slice;
 
module.exports = {
  _bindEvent: function() {
    return this.bindEvent || this.props.bindEvent || 'change';
  },
  _bindStore: function() {
    return (typeof this.bindStore === "function" ? this.bindStore() : void 0) || this.bindStore;
  },
  _bindUpdate: function() {
    var args;
    args = 1 <= arguments.length ? slice.call(arguments, 0) : [];
    if (this.bindUpdate != null) {
      return this.bindUpdate.apply(this, args);
    } else {
      return this.setState({});
    }
  },
  _addListener: function() {
    var bindStore;
    this.boundEvent = this._bindEvent();
    Iif (typeof this.addBindListener === "function") {
      this.addBindListener();
    }
    bindStore = this._bindStore();
    Eif (this._bindStore != null) {
      return bindStore.on(this.boundEvent, this._bindUpdate);
    }
  },
  _removeListener: function() {
    var bindStore;
    Iif (typeof this.removeBindListener === "function") {
      this.removeBindListener();
    }
    bindStore = this._bindStore();
    Eif (this._bindStore != null) {
      return bindStore.off(this.boundEvent, this._bindUpdate);
    }
  },
  componentWillMount: function() {
    return this._addListener();
  },
  componentWillUnmount: function() {
    return this._removeListener();
  }
};