dataflux 1.9.5 → 1.10.0

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
@@ -234,6 +234,8 @@ The method `findAll` returns always an array. The method `findOne` returns a sin
234
234
 
235
235
  When the component will unmount, the `findAll` subscription will be automatically terminated without the need to unsubscribe. Be aware, `store.findAll()` injects the unsubscribe call inside `componentWillUnmount()`. If your component already implements `componentWillUnmount()`, then you will have to use `store.subscribe()` and `store.unsubscribe()` instead of `store.findAll()`, to avoid side effects when the component is unmounted.
236
236
 
237
+ > Note: handleChange allows for type casting. E.g., store.handleChange(book, "pages", Integer.parseInt)
238
+
237
239
  In case you prefer React hooks:
238
240
 
239
241
  ```js
@@ -108,12 +108,11 @@ var ReactStore = /*#__PURE__*/function (_ObserverStore) {
108
108
  }
109
109
  });
110
110
 
111
- _defineProperty(_assertThisInitialized(_this), "handleChange", function (object, name) {
111
+ _defineProperty(_assertThisInitialized(_this), "handleChange", function (object, name, cast) {
112
112
  return function (event, rawValue) {
113
- var _ref;
114
-
115
113
  var value = event ? event.target.type === "checkbox" ? event.target.checked : event.target.value : "";
116
- object.set(name, (_ref = value !== null && value !== void 0 ? value : rawValue) !== null && _ref !== void 0 ? _ref : "");
114
+ var finalValue = value !== null && value !== void 0 ? value : rawValue;
115
+ object.set(name, cast && finalValue != null ? cast(finalValue) : finalValue);
117
116
  };
118
117
  });
119
118