dataflux 1.19.4 → 1.19.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Model.js +3 -1
- package/dist/Obj.js +2 -2
- package/dist/dataflux.min.js +1 -1
- package/dist/dataflux.min.js.map +1 -1
- package/package.json +1 -1
package/dist/Model.js
CHANGED
|
@@ -156,7 +156,7 @@ var Model = exports["default"] = /*#__PURE__*/_createClass(function Model(name)
|
|
|
156
156
|
throw new Error("This model was already assigned to a store.");
|
|
157
157
|
}
|
|
158
158
|
});
|
|
159
|
-
_defineProperty(this, "load", function (obj) {
|
|
159
|
+
_defineProperty(this, "load", function (obj, callback) {
|
|
160
160
|
if (_classPrivateFieldGet(_loadFunction, _this)) {
|
|
161
161
|
return _this.getStore().whenSaved(_this.getType())["catch"](function (e) {
|
|
162
162
|
throw new Error("You cannot perform load() on an unsaved object.");
|
|
@@ -170,6 +170,8 @@ var Model = exports["default"] = /*#__PURE__*/_createClass(function Model(name)
|
|
|
170
170
|
responseType: "json"
|
|
171
171
|
}).then(function (data) {
|
|
172
172
|
return data.data;
|
|
173
|
+
}).then(function (data) {
|
|
174
|
+
return callback ? callback(data) : data;
|
|
173
175
|
});
|
|
174
176
|
} else {
|
|
175
177
|
return res;
|
package/dist/Obj.js
CHANGED
|
@@ -79,13 +79,13 @@ var Obj = exports["default"] = /*#__PURE__*/function (_BasicObj) {
|
|
|
79
79
|
_classPrivateFieldSet(_loaded, _this, false);
|
|
80
80
|
}
|
|
81
81
|
});
|
|
82
|
-
_defineProperty(_this, "load", function () {
|
|
82
|
+
_defineProperty(_this, "load", function (callback) {
|
|
83
83
|
if (_this.isMock()) {
|
|
84
84
|
return Promise.reject("You cannot perform load on a mock object. Use factory instead.");
|
|
85
85
|
} else {
|
|
86
86
|
if (!_classPrivateFieldGet(_loaded, _this)) {
|
|
87
87
|
var model = _this.getModel();
|
|
88
|
-
_classPrivateFieldSet(_loaded, _this, model.load(_this).then(function () {
|
|
88
|
+
_classPrivateFieldSet(_loaded, _this, model.load(_this, callback).then(function () {
|
|
89
89
|
return model.getStore().update([_this], true);
|
|
90
90
|
}) // Propagate update
|
|
91
91
|
.then(function () {
|