1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | 'use strict';Object.defineProperty(exports,"__esModule",{value:!0});var l=require("react");function m(a){for(var e=a.message,f="https://reactjs.org/docs/error-decoder.html?invariant="+e,h=1;h<arguments.length;h++)f+="&args[]="+encodeURIComponent(arguments[h]);a.message="Minified React error #"+e+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ";return a}
|
11 | function n(a,e){a.prototype=Object.create(e.prototype);a.prototype.constructor=a;a.__proto__=e}
|
12 | exports.createSubscription=function(a){var e=a.getCurrentValue,f=a.subscribe;return function(a){function g(){var b=arguments.length;for(var k=Array(b),c=0;c<b;c++)k[c]=arguments[c];b=a.call.apply(a,[this].concat(k))||this;b.state={source:b.props.source,value:null!=b.props.source?e(b.props.source):void 0};b._hasUnmounted=!1;b._unsubscribe=null;return b}n(g,a);g.getDerivedStateFromProps=function(b,a){return b.source!==a.source?{source:b.source,value:null!=b.source?e(b.source):void 0}:null};var d=g.prototype;
|
13 | d.componentDidMount=function(){this.subscribe()};d.componentDidUpdate=function(b,a){this.state.source!==a.source&&(this.unsubscribe(),this.subscribe())};d.componentWillUnmount=function(){this.unsubscribe();this._hasUnmounted=!0};d.render=function(){return this.props.children(this.state.value)};d.subscribe=function(){var a=this,d=this.state.source;if(null!=d){var c=f(d,function(b){a._hasUnmounted||a.setState(function(a){return b===a.value||d!==a.source?null:{value:b}})});if("function"!==typeof c)throw m(Error(266));
|
14 | this._unsubscribe=c;c=e(this.props.source);c!==this.state.value&&this.setState({value:c})}};d.unsubscribe=function(){"function"===typeof this._unsubscribe&&this._unsubscribe();this._unsubscribe=null};return g}(l.Component)};
|