Comparing version 0.0.13 to 0.1.0
@@ -9,3 +9,3 @@ 'use strict'; | ||
var _desc, _value, _class, _descriptor, _descriptor2, _descriptor3; /* globals Class */ | ||
var _desc, _value, _class, _descriptor; /* globals Class */ | ||
@@ -19,6 +19,2 @@ | ||
var _Api = require('./Api'); | ||
var _Api2 = _interopRequireDefault(_Api); | ||
var _lodash = require('lodash.difference'); | ||
@@ -80,13 +76,11 @@ | ||
var Collection = (_class = function () { | ||
function Collection(data) { | ||
// eslint-disable-line | ||
function Collection(data, Api) { | ||
_classCallCheck(this, Collection); | ||
_initDefineProp(this, 'request', _descriptor, this); | ||
_initDefineProp(this, 'models', _descriptor, this); | ||
_initDefineProp(this, 'error', _descriptor2, this); | ||
this.api = new Api(this.url()); | ||
_initDefineProp(this, 'models', _descriptor3, this); | ||
this.api = new _Api2.default(this.url()); | ||
if (data) this.set(data); | ||
@@ -317,10 +311,4 @@ } | ||
return Collection; | ||
}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'request', [_mobx.observable], { | ||
}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'models', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: null | ||
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'error', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: null | ||
}), _descriptor3 = _applyDecoratedDescriptor(_class.prototype, 'models', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: function initializer() { | ||
@@ -327,0 +315,0 @@ return []; |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var _desc, _value, _class, _descriptor, _descriptor2; | ||
var _desc, _value, _class; | ||
@@ -24,12 +24,2 @@ var _mobx = require('mobx'); | ||
function _initDefineProp(target, property, descriptor, context) { | ||
if (!descriptor) return; | ||
Object.defineProperty(target, property, { | ||
enumerable: descriptor.enumerable, | ||
configurable: descriptor.configurable, | ||
writable: descriptor.writable, | ||
value: descriptor.initializer ? descriptor.initializer.call(context) : void 0 | ||
}); | ||
} | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -66,6 +56,2 @@ | ||
function _initializerWarningHelper(descriptor, context) { | ||
throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.'); | ||
} | ||
var Model = (_class = function () { | ||
@@ -75,6 +61,2 @@ function Model(collection, attributes) { | ||
_initDefineProp(this, 'request', _descriptor, this); | ||
_initDefineProp(this, 'error', _descriptor2, this); | ||
this.uuid = _nodeUuid2.default.v4(); | ||
@@ -202,9 +184,3 @@ this.collection = collection; | ||
return Model; | ||
}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'request', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: null | ||
}), _descriptor2 = _applyDecoratedDescriptor(_class.prototype, 'error', [_mobx.observable], { | ||
enumerable: true, | ||
initializer: null | ||
}), _applyDecoratedDescriptor(_class.prototype, 'set', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'set'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'save', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'save'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'destroy', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'destroy'), _class.prototype)), _class); | ||
}(), (_applyDecoratedDescriptor(_class.prototype, 'set', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'set'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'save', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'save'), _class.prototype), _applyDecoratedDescriptor(_class.prototype, 'destroy', [_mobx.action], Object.getOwnPropertyDescriptor(_class.prototype, 'destroy'), _class.prototype)), _class); | ||
exports.default = Model; |
{ | ||
"name": "mobx-rest", | ||
"version": "0.0.13", | ||
"version": "0.1.0", | ||
"description": "REST conventions for mobx.", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -25,5 +25,4 @@ /*global describe, it, context, beforeEach*/ | ||
item = {id: 1, name: 'miles'} | ||
collection = new Collection([item]) | ||
api = new MockApi() | ||
collection.api = api | ||
collection = new Collection([item], MockApi) | ||
api = collection.api | ||
}) | ||
@@ -30,0 +29,0 @@ |
@@ -27,6 +27,5 @@ /*global describe, it, context, beforeEach*/ | ||
item = {id: 1, name: 'miles', album: 'kind of blue'} | ||
collection = new Collection([item]) | ||
collection = new Collection([item], MockApi) | ||
api = collection.api | ||
model = collection.at(0) | ||
api = new MockApi() | ||
collection.api = api | ||
}) | ||
@@ -33,0 +32,0 @@ |
Sorry, the diff of this file is not supported yet
36072
847