client/hippo/models/base.js in hippo-fw-0.9.7 vs client/hippo/models/base.js in hippo-fw-0.9.8
- old
+ new
@@ -27,10 +27,11 @@
export {
observable, computed,
};
export class BaseModel {
+
static get propType() {
return PropTypes.instanceOf(this);
}
static findDerived(name) {
@@ -41,11 +42,11 @@
return Array.from(this.$schema.keys());
}
static get propertyOptions() {
const options = {};
- this.$schema.forEach((val, name) => (options[name] = val.options));
+ this.$schema.forEach((val, name) => { options[name] = val.options; });
return options;
}
static get syncUrl() {
invariant(this.identifiedBy, 'must have an identifiedBy property in order to calulate syncUrl');
@@ -57,11 +58,12 @@
invariant(field, 'identifierFieldName called on a model that has not designated one with `@identifier`');
return field.name;
}
static get Collection() {
- return this.$collection || (this.$collection = new ModelCollection(this));
+ if (!this.$collection) { this.$collection = new ModelCollection(this); }
+ return this.$collection;
}
constructor(attrs) {
if (!isEmpty(attrs)) {
this.set(attrs);
@@ -134,8 +136,9 @@
}
destroy(options = {}) {
return Sync.forModel(this, extend(options, { action: 'destroy' }));
}
+
}
export default BaseModel;