Sha256: 53941b5c253ad14da209a28a4efd3265b61343ad03308c527c68741a7d4946bf

Contents?: true

Size: 1.16 KB

Versions: 8

Compression:

Stored size: 1.16 KB

Contents

(function() {
  Rev.registerMixin('BackboneProps', {
    componentWillMount: function() {
      return this.backbonify(this.props);
    },
    componentWillReceiveProps: function(nextProps) {
      return this.backbonify(nextProps);
    },
    backbonify: function(props) {
      var data, klass, name, results;
      this.__bb = [];
      results = [];
      for (name in this.backboneMap) {
        data = props[name];
        if ((data != null) && (data != null) && !(data instanceof Backbone.Model || data instanceof Backbone.Collection)) {
          klass = this.backboneMap[name];
          props[name] = new klass(data);
        }
        results.push(this.__bb.push(props[name]));
      }
      return results;
    },
    componentDidMount: function() {
      return _.each(this.__bb, (function(_this) {
        return function(model) {
          return model.on('all', _this.forceUpdate.bind(_this, null), _this);
        };
      })(this));
    },
    componentWillUnmount: function() {
      return _.each(this.__bb, (function(_this) {
        return function(model) {
          return model.off(null, null, _this);
        };
      })(this));
    }
  });

}).call(this);

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
revelry_core-0.1.12.4 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.12.2 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.11.6 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.10.1 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.10.0 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.9.1 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.9.0 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js
revelry_core-0.1.8.0 spec/dummy/tmp/jasmine/assets/revelry/mixins/BackboneProps.self.js