|
63 | 63 | /******/ __webpack_require__.p = "";
|
64 | 64 | /******/
|
65 | 65 | /******/ // Load entry module and return exports
|
66 |
| -/******/ return __webpack_require__(__webpack_require__.s = 34); |
| 66 | +/******/ return __webpack_require__(__webpack_require__.s = 53); |
67 | 67 | /******/ })
|
68 | 68 | /************************************************************************/
|
69 | 69 | /******/ ({
|
|
72 | 72 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
|
73 | 73 |
|
74 | 74 | "use strict";
|
75 |
| -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observer__ = __webpack_require__(53); |
| 75 | +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observer__ = __webpack_require__(34); |
76 | 76 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__internals__ = __webpack_require__(26);
|
77 | 77 | /* harmony export (immutable) */ __webpack_exports__["a"] = has;
|
78 | 78 | /* harmony export (immutable) */ __webpack_exports__["d"] = get;
|
@@ -246,73 +246,6 @@ const rawToProxy = new WeakMap()
|
246 | 246 | /***/ 34:
|
247 | 247 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
|
248 | 248 |
|
249 |
| -"use strict"; |
250 |
| -Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); |
251 |
| -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__nx_js_observer_util__ = __webpack_require__(86); |
252 |
| -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__autoBind__ = __webpack_require__(87); |
253 |
| -/* harmony export (immutable) */ __webpack_exports__["default"] = easyStateHOC; |
254 |
| - |
255 |
| - |
256 |
| - |
257 |
| -const OBSERVED_RENDER = Symbol('observed render') |
258 |
| -const IS_DIRECT_RENDER = Symbol('is direct render') |
259 |
| -const RENDER_RESULT = Symbol('render result') |
260 |
| - |
261 |
| -function easyStateHOC (WrappedComp) { |
262 |
| - return class EasyStateWrapper extends WrappedComp { |
263 |
| - constructor (props) { |
264 |
| - super(props) |
265 |
| - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__autoBind__["a" /* default */])(this, WrappedComp.prototype) |
266 |
| - this.state = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__nx_js_observer_util__["a" /* observable */])(this.state) |
267 |
| - } |
268 |
| - |
269 |
| - render () { |
270 |
| - if (!this[OBSERVED_RENDER]) { |
271 |
| - this[OBSERVED_RENDER] = () => { |
272 |
| - if (this[IS_DIRECT_RENDER]) { |
273 |
| - this[RENDER_RESULT] = super.render() |
274 |
| - } else { |
275 |
| - super.forceUpdate() |
276 |
| - } |
277 |
| - } |
278 |
| - } |
279 |
| - |
280 |
| - this[IS_DIRECT_RENDER] = true |
281 |
| - __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__nx_js_observer_util__["b" /* observe */])(this[OBSERVED_RENDER]) |
282 |
| - this[IS_DIRECT_RENDER] = false |
283 |
| - |
284 |
| - return this[RENDER_RESULT] |
285 |
| - } |
286 |
| - |
287 |
| - shouldComponentUpdate (nextProps) { |
288 |
| - if (super.shouldComponentUpdate) { |
289 |
| - return super.shouldComponentUpdate() |
290 |
| - } |
291 |
| - |
292 |
| - const { props } = this |
293 |
| - const keys = Object.keys(props) |
294 |
| - const nextKeys = Object.keys(nextProps) |
295 |
| - |
296 |
| - if (keys.length !== nextKeys.length) { |
297 |
| - return true |
298 |
| - } |
299 |
| - |
300 |
| - for (let key of keys) { |
301 |
| - if (props[key] !== nextProps[key]) { |
302 |
| - return true |
303 |
| - } |
304 |
| - } |
305 |
| - return false |
306 |
| - } |
307 |
| - } |
308 |
| -} |
309 |
| - |
310 |
| - |
311 |
| -/***/ }), |
312 |
| - |
313 |
| -/***/ 53: |
314 |
| -/***/ (function(module, __webpack_exports__, __webpack_require__) { |
315 |
| - |
316 | 249 | "use strict";
|
317 | 250 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__nextTick__ = __webpack_require__(93);
|
318 | 251 | /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__builtIns_index__ = __webpack_require__(92);
|
@@ -475,13 +408,80 @@ function runObserver (observer) {
|
475 | 408 | }
|
476 | 409 |
|
477 | 410 |
|
| 411 | +/***/ }), |
| 412 | + |
| 413 | +/***/ 53: |
| 414 | +/***/ (function(module, __webpack_exports__, __webpack_require__) { |
| 415 | + |
| 416 | +"use strict"; |
| 417 | +Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); |
| 418 | +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__nx_js_observer_util__ = __webpack_require__(86); |
| 419 | +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__autoBind__ = __webpack_require__(87); |
| 420 | +/* harmony export (immutable) */ __webpack_exports__["default"] = easyStateHOC; |
| 421 | + |
| 422 | + |
| 423 | + |
| 424 | +const OBSERVED_RENDER = Symbol('observed render') |
| 425 | +const IS_DIRECT_RENDER = Symbol('is direct render') |
| 426 | +const RENDER_RESULT = Symbol('render result') |
| 427 | + |
| 428 | +function easyStateHOC (WrappedComp) { |
| 429 | + return class EasyStateWrapper extends WrappedComp { |
| 430 | + constructor (props) { |
| 431 | + super(props) |
| 432 | + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__autoBind__["a" /* default */])(this, WrappedComp.prototype) |
| 433 | + this.state = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__nx_js_observer_util__["a" /* observable */])(this.state) |
| 434 | + } |
| 435 | + |
| 436 | + render () { |
| 437 | + if (!this[OBSERVED_RENDER]) { |
| 438 | + this[OBSERVED_RENDER] = () => { |
| 439 | + if (this[IS_DIRECT_RENDER]) { |
| 440 | + this[RENDER_RESULT] = super.render() |
| 441 | + } else { |
| 442 | + super.forceUpdate() |
| 443 | + } |
| 444 | + } |
| 445 | + } |
| 446 | + |
| 447 | + this[IS_DIRECT_RENDER] = true |
| 448 | + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__nx_js_observer_util__["b" /* observe */])(this[OBSERVED_RENDER]) |
| 449 | + this[IS_DIRECT_RENDER] = false |
| 450 | + |
| 451 | + return this[RENDER_RESULT] |
| 452 | + } |
| 453 | + |
| 454 | + shouldComponentUpdate (nextProps) { |
| 455 | + if (super.shouldComponentUpdate) { |
| 456 | + return super.shouldComponentUpdate() |
| 457 | + } |
| 458 | + |
| 459 | + const { props } = this |
| 460 | + const keys = Object.keys(props) |
| 461 | + const nextKeys = Object.keys(nextProps) |
| 462 | + |
| 463 | + if (keys.length !== nextKeys.length) { |
| 464 | + return true |
| 465 | + } |
| 466 | + |
| 467 | + for (let key of keys) { |
| 468 | + if (props[key] !== nextProps[key]) { |
| 469 | + return true |
| 470 | + } |
| 471 | + } |
| 472 | + return false |
| 473 | + } |
| 474 | + } |
| 475 | +} |
| 476 | + |
| 477 | + |
478 | 478 | /***/ }),
|
479 | 479 |
|
480 | 480 | /***/ 86:
|
481 | 481 | /***/ (function(module, __webpack_exports__, __webpack_require__) {
|
482 | 482 |
|
483 | 483 | "use strict";
|
484 |
| -/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observer__ = __webpack_require__(53); |
| 484 | +/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__observer__ = __webpack_require__(34); |
485 | 485 | /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_0__observer__["a"]; });
|
486 | 486 | /* unused harmony reexport isObservable */
|
487 | 487 | /* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_0__observer__["b"]; });
|
|
0 commit comments