@tarojs/mobx
Advanced tools
+15
-65
@@ -14,3 +14,2 @@ 'use strict'; | ||
| } | ||
| function _defineProperties(target, props) { | ||
@@ -25,9 +24,10 @@ for (var i = 0; i < props.length; i++) { | ||
| } | ||
| function _createClass(Constructor, protoProps, staticProps) { | ||
| if (protoProps) _defineProperties(Constructor.prototype, protoProps); | ||
| if (staticProps) _defineProperties(Constructor, staticProps); | ||
| Object.defineProperty(Constructor, "prototype", { | ||
| writable: false | ||
| }); | ||
| return Constructor; | ||
| } | ||
| function _defineProperty(obj, key, value) { | ||
@@ -44,6 +44,4 @@ if (key in obj) { | ||
| } | ||
| return obj; | ||
| } | ||
| function _inherits(subClass, superClass) { | ||
@@ -53,3 +51,2 @@ if (typeof superClass !== "function" && superClass !== null) { | ||
| } | ||
| subClass.prototype = Object.create(superClass && superClass.prototype, { | ||
@@ -62,7 +59,9 @@ constructor: { | ||
| }); | ||
| Object.defineProperty(subClass, "prototype", { | ||
| writable: false | ||
| }); | ||
| if (superClass) _setPrototypeOf(subClass, superClass); | ||
| } | ||
| function _getPrototypeOf(o) { | ||
| _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { | ||
| _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { | ||
| return o.__proto__ || Object.getPrototypeOf(o); | ||
@@ -72,12 +71,9 @@ }; | ||
| } | ||
| function _setPrototypeOf(o, p) { | ||
| _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { | ||
| _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { | ||
| o.__proto__ = p; | ||
| return o; | ||
| }; | ||
| return _setPrototypeOf(o, p); | ||
| } | ||
| function _isNativeReflectConstruct() { | ||
@@ -87,3 +83,2 @@ if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
| if (typeof Proxy === "function") return true; | ||
| try { | ||
@@ -96,3 +91,2 @@ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); | ||
| } | ||
| function _assertThisInitialized(self) { | ||
@@ -102,6 +96,4 @@ if (self === void 0) { | ||
| } | ||
| return self; | ||
| } | ||
| function _possibleConstructorReturn(self, call) { | ||
@@ -113,16 +105,11 @@ if (call && (typeof call === "object" || typeof call === "function")) { | ||
| } | ||
| return _assertThisInitialized(self); | ||
| } | ||
| function _createSuper(Derived) { | ||
| var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
| return function _createSuperInternal() { | ||
| var Super = _getPrototypeOf(Derived), | ||
| result; | ||
| result; | ||
| if (hasNativeReflectConstruct) { | ||
| var NewTarget = _getPrototypeOf(this).constructor; | ||
| result = Reflect.construct(Super, arguments, NewTarget); | ||
@@ -132,7 +119,5 @@ } else { | ||
| } | ||
| return _possibleConstructorReturn(this, result); | ||
| }; | ||
| } | ||
| function _superPropBase(object, property) { | ||
@@ -143,25 +128,19 @@ while (!Object.prototype.hasOwnProperty.call(object, property)) { | ||
| } | ||
| return object; | ||
| } | ||
| function _get(target, property, receiver) { | ||
| function _get() { | ||
| if (typeof Reflect !== "undefined" && Reflect.get) { | ||
| _get = Reflect.get; | ||
| _get = Reflect.get.bind(); | ||
| } else { | ||
| _get = function _get(target, property, receiver) { | ||
| var base = _superPropBase(target, property); | ||
| if (!base) return; | ||
| var desc = Object.getOwnPropertyDescriptor(base, property); | ||
| if (desc.get) { | ||
| return desc.get.call(receiver); | ||
| return desc.get.call(arguments.length < 3 ? target : receiver); | ||
| } | ||
| return desc.value; | ||
| }; | ||
| } | ||
| return _get(target, property, receiver || target); | ||
| return _get.apply(this, arguments); | ||
| } | ||
@@ -172,11 +151,7 @@ | ||
| _inherits(Injector, _Component); | ||
| var _super = _createSuper(Injector); | ||
| function Injector(props, isPage) { | ||
| _classCallCheck(this, Injector); | ||
| return _super.call(this, Object.assign.apply(Object, Array.prototype.slice.call(arguments).concat([mobxCommon.mapStoreToProps(grabStoresFn, props)])), isPage); | ||
| } | ||
| _createClass(Injector, [{ | ||
@@ -189,13 +164,8 @@ key: "_constructor", | ||
| }]); | ||
| return Injector; | ||
| }(Component); | ||
| _defineProperty(Injector, "isMobxInjector", true); | ||
| _defineProperty(Injector, "displayName", mobxCommon.getInjectName(Component, injectNames)); | ||
| return Injector; | ||
| } | ||
| function inject() { | ||
@@ -209,13 +179,9 @@ return mobxCommon.inject.apply(void 0, Array.prototype.slice.call(arguments).concat([createStoreInjector])); | ||
| } | ||
| if (component.isMobxInjector === true) { | ||
| console.warn("Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'"); | ||
| } | ||
| var target = component.prototype; | ||
| var originConstructor = target._constructor; | ||
| target._constructor = function () { | ||
| var _this = this; | ||
| if (this.$scope) { | ||
@@ -225,12 +191,8 @@ var initialName = this.displayName || this.name; | ||
| _this.componentWillReact && _this.componentWillReact(); | ||
| _this.forceUpdate(); | ||
| }); | ||
| } | ||
| originConstructor && originConstructor.call(this, this.props); | ||
| }; | ||
| var originComponentWillUnmount = target.componentWillUnmount; | ||
| target.componentWillUnmount = function () { | ||
@@ -240,18 +202,12 @@ if (this._reaction) { | ||
| } | ||
| originComponentWillUnmount && originComponentWillUnmount.call(this); | ||
| }; | ||
| var originRender = target._createData; | ||
| target._createData = function () { | ||
| var _this2 = this; | ||
| for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
| args[_key] = arguments[_key]; | ||
| } | ||
| var result; | ||
| var exception; | ||
| if (this._reaction instanceof mobx.Reaction) { | ||
@@ -268,3 +224,2 @@ this._reaction.track(function () { | ||
| } | ||
| if (exception) { | ||
@@ -274,21 +229,16 @@ mobxCommon.errorsReporter.emit(exception); | ||
| } | ||
| return result; | ||
| }; | ||
| return component; | ||
| } | ||
| var Provider = function Provider() { | ||
| var Provider = /*#__PURE__*/_createClass(function Provider() { | ||
| _classCallCheck(this, Provider); | ||
| }; | ||
| }); | ||
| function useLocalStore(initializer, current) { | ||
| return mobxCommon.useLocalStore(initializer, current, taro.useState); | ||
| } | ||
| function useAsObservableSource(current) { | ||
| return mobxCommon.useAsObservableSource(current, taro.useState); | ||
| } | ||
| var index = { | ||
@@ -295,0 +245,0 @@ PropTypes: mobxCommon.PropTypes, |
+4
-4
| { | ||
| "name": "@tarojs/mobx", | ||
| "version": "2.2.18", | ||
| "version": "2.2.19", | ||
| "description": "mobx for taro", | ||
@@ -27,4 +27,4 @@ "keywords": [ | ||
| "dependencies": { | ||
| "@tarojs/mobx-common": "2.2.18", | ||
| "@tarojs/taro": "2.2.18" | ||
| "@tarojs/mobx-common": "2.2.19", | ||
| "@tarojs/taro": "2.2.19" | ||
| }, | ||
@@ -36,3 +36,3 @@ "devDependencies": { | ||
| }, | ||
| "gitHead": "53c891ced0d121f940dbabc8294afc96b10690d4" | ||
| "gitHead": "64d57843cb01f25d9dc738ad26765e7c52cae8e6" | ||
| } |
11520
1.38%271
2.26%+ Added
+ Added
+ Added
- Removed
- Removed
- Removed
Updated
Updated