From dd2f092791d1f4e315d6591390fc173b8b7edd7b Mon Sep 17 00:00:00 2001 From: Jeroen van der Heijden Date: Mon, 6 Apr 2020 08:25:36 +0200 Subject: [PATCH] Build --- lib/actions.js | 4 +--- lib/component.js | 21 ++++++++++++--------- lib/store.js | 4 +--- lib/withVlow.js | 12 ++++++++---- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/lib/actions.js b/lib/actions.js index acad5f5..6b5587a 100644 --- a/lib/actions.js +++ b/lib/actions.js @@ -18,9 +18,7 @@ var _invariant = _interopRequireDefault(require("invariant")); /* global process */ /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ -var Actions = -/*#__PURE__*/ -function () { +var Actions = /*#__PURE__*/function () { function Actions(names) { var _this = this; diff --git a/lib/component.js b/lib/component.js index 776175c..768c814 100644 --- a/lib/component.js +++ b/lib/component.js @@ -25,18 +25,21 @@ var _states = _interopRequireDefault(require("./states")); var _invariant = _interopRequireDefault(require("invariant")); -/* global process */ +function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + var ComponentFactory = function ComponentFactory(SuperClass) { - var Component = - /*#__PURE__*/ - function (_SuperClass) { + var Component = /*#__PURE__*/function (_SuperClass) { (0, _inherits2["default"])(Component, _SuperClass); + var _super = _createSuper(Component); + function Component(props) { var _this; (0, _classCallCheck2["default"])(this, Component); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Component).call(this, props)); + _this = _super.call(this, props); _this._vlowStores_ = {}; _this._vlowState_ = _states["default"].init; _this._vlowTmpState = null; @@ -112,14 +115,14 @@ var ComponentFactory = function ComponentFactory(SuperClass) { return Component; }; -var Component = -/*#__PURE__*/ -function (_ComponentFactory) { +var Component = /*#__PURE__*/function (_ComponentFactory) { (0, _inherits2["default"])(Component, _ComponentFactory); + var _super2 = _createSuper(Component); + function Component() { (0, _classCallCheck2["default"])(this, Component); - return (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(Component).apply(this, arguments)); + return _super2.apply(this, arguments); } (0, _createClass2["default"])(Component, null, [{ diff --git a/lib/store.js b/lib/store.js index 28f46c8..2d7c5af 100644 --- a/lib/store.js +++ b/lib/store.js @@ -22,9 +22,7 @@ var _invariant = _interopRequireDefault(require("invariant")); /* eslint no-console: ["error", { allow: ["warn", "error"] }] */ var _stores = []; -var Store = -/*#__PURE__*/ -function () { +var Store = /*#__PURE__*/function () { function Store() { var _this = this; diff --git a/lib/withVlow.js b/lib/withVlow.js index ce008af..2d1f470 100644 --- a/lib/withVlow.js +++ b/lib/withVlow.js @@ -23,6 +23,10 @@ var _react = _interopRequireDefault(require("react")); var _component = _interopRequireDefault(require("./component")); +function _createSuper(Derived) { return function () { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (_isNativeReflectConstruct()) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; } + +function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } + var withVlow = function withVlow(stores, WrappedComponent) { if (WrappedComponent === undefined) { return function (WrappedComponent) { @@ -30,16 +34,16 @@ var withVlow = function withVlow(stores, WrappedComponent) { }; } - var WithVlow = - /*#__PURE__*/ - function (_Component) { + var WithVlow = /*#__PURE__*/function (_Component) { (0, _inherits2["default"])(WithVlow, _Component); + var _super = _createSuper(WithVlow); + function WithVlow(props) { var _this; (0, _classCallCheck2["default"])(this, WithVlow); - _this = (0, _possibleConstructorReturn2["default"])(this, (0, _getPrototypeOf2["default"])(WithVlow).call(this, props)); + _this = _super.call(this, props); Array.isArray(stores) ? _this.mapStores(stores) : _this.mapStore(stores); return _this; }