Repository URL to install this package:
|
Version:
1.3.2 ▾
|
| .. |
| README.md |
| ReactTap.tsx |
| index.ts |
// Object.defineProperty(React, 'Observer', { // configurable: true, // enumerable: true, // value: ReactComponentOverride, // }) // ======================== // this just is an observable component // @example class Eh extends React.Observer // // eslint-disable-next-line // var ReactComponentTap = (function (ReactComponent) { // // eslint-disable-next-line // function ReactComponentOverride(props, context, updater) { // // "super" // const $this = ReactComponent.call(this, props, context, updater) // // right here // // this is before the component extending React.Component calls super // const name = toComponentName(this) // // console.log('TAP: ', name) // // if (name === 'ProxyComponent') { // // return this // // } // // if (this instanceof React.PureComponent) { // // console.log('PURE', name) // // return this // // } else { // // console.log('COMPONENT: ', name) // // } // // const prototype = Object.getPrototypeOf(this).__proto__ // const prototype = this.__proto__ // const statics = Object.keys(prototype.constructor) // const initialProps = statics.initialProps // if (isFunction(initialProps)) { // const asyncResult = initialProps() // if (typeof window === 'object') { // window.asyncResult = asyncResult // } // } // return this // } // // prototype the old fashioned way // if (ReactComponent) { // // eslint-disable-next-line // ReactComponentOverride.__proto__ = ReactComponent // } // ReactComponentOverride.prototype = Object.create(ReactComponent && ReactComponent.prototype) // ReactComponentOverride.prototype.constructor = ReactComponentOverride // return ReactComponentOverride // })(ReactComponent) // Object.defineProperty(React, 'Component', { // configurable: true, // enumerable: true, // value: ReactComponentTap, // }) // es6 extension observer // class Observer extends React.Component { // constructor(...args) { // super(...args) // const render = this.render // const observableRender = () => { // return <ErrorBoundary>{render()}</ErrorBoundary> // } // this.render = observableRender // } // } // Object.defineProperty(React, 'Observer', { // configurable: true, // enumerable: true, // value: Observer, // })