dataflux 1.7.3 → 1.7.4

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/README.md CHANGED
@@ -20,7 +20,7 @@ npm install dataflux
20
20
 
21
21
  Using jsDelivr CDN:
22
22
  ```html
23
- <script src="https://cdn.jsdelivr.net/npm/dataflux/dist/index.js"></script>
23
+ <script src="https://cdn.jsdelivr.net/npm/dataflux/dist/dataflux.min.js"></script>
24
24
  ```
25
25
 
26
26
  ## Examples
@@ -31,7 +31,7 @@ Consider the following hypothetical store/model declaration common to all the ex
31
31
 
32
32
  ```js
33
33
  // Content of your store.js
34
- import {Store, Model} from "dataflux";
34
+ const {Store, Model} = require("dataflux");
35
35
 
36
36
  // We create a new Store
37
37
  const store = new Store();
@@ -182,7 +182,7 @@ const callback = ({book, author}) => {
182
182
  // Objects are ready
183
183
  };
184
184
 
185
- const subKey = store.multipleSubscribe(requests, callback); // Subscribe
185
+ const subKey = store.multipleSubscribe(subscriptions, callback); // Subscribe
186
186
 
187
187
  store.unsubscribe(subKey); // Unsubscribe
188
188
  ```
@@ -205,8 +205,8 @@ class MyComponent extends React.Component {
205
205
  // Get all books with a price < 20
206
206
  store.findAll("book", "books", this, ({price}) => price < 20);
207
207
  // An attribute "books" will be added/updated in the
208
- // state (the rest of the state remains unchanged) every time
209
- // a book in our selection is inserted/deleted/edited.
208
+ // state every time a book in our selection is inserted/deleted/edited,
209
+ // the rest of the state remains unchanged.
210
210
 
211
211
  // findAll is a syntactic sugar for:
212
212
  // const callback = (books) => {this.setState({...this.state, books})};
package/dist/Model.js CHANGED
@@ -195,7 +195,8 @@ var Model = /*#__PURE__*/_createClass(function Model(name) {
195
195
  return _this.getStore().whenSaved(_this.getType())["catch"](function (e) {
196
196
  throw new Error("You cannot perform load() on an unsaved object.");
197
197
  }).then(function () {
198
- var res = _classPrivateFieldGet(_this, _loadFunction).call(_this, obj.toJSON());
198
+ var res = _classPrivateFieldGet(_this, _loadFunction).call(_this, obj.toJSON()); // toJSON to avoid side effects;
199
+
199
200
 
200
201
  if (typeof res === "string") {
201
202
  return _classPrivateFieldGet(_this, _axios).call(_this, {