import Store from '../store' ; param relaxProps const relaxData = relaxProps => { const data = { } ; for ( let prop in relaxProps ) { if ( prop === 'viewAction' || typeof relaxProps [ prop ] == 'function' ) { data [ prop ] = `store@${ prop }` ; continue ; } data [ prop ] = relaxProps [ prop ] ; } return data ; } ; param relax param Relax export const outputRelaxProps = ( { Relax , relax , lifecycle } ) => { console . groupCollapsed && console . groupCollapsed ( `${ Relax . displayName } ${ lifecycle } rx store ${ relax . _isNeedRxStore } 🚀` ) ; const _relaxProps = relax . _relaxProps ; for ( let prop in _relaxProps ) { const propVal = _relaxProps [ prop ] ; if ( typeof propVal === 'undefined' ) { console . warn ( `relaxProps[${ prop }] Could not find any value from store` ) ; } } console . log ( 'props => ' + JSON . stringify ( { relaxProps : { ... relaxData ( _relaxProps ) } } , null , 2 ) ) ; console . groupEnd && console . groupEnd ( ) ; } ; export const ifNoStoreInContext = ctx => { if ( ! ctx . _plume$Store ) { throw new Error ( 'Could not find any store in context, Please add @StoreProvder on top React Component' ) ; } } ; export const ifNoViewActionInStore = ( store ) => { if ( ! store . viewAction ) { console . error ( `store can not find viewAction, please bind viewAction first` ) ; } } ; const relaxCount = { } ; export const ifTooManyRelaxContainer = { watch : Relax => { const count = relaxCount [ Relax . displayName ] ; if ( typeof count != 'number' ) { relaxCount [ Relax . displayName ] = 1 ; } else { relaxCount [ Relax . displayName ] ++ ; } if ( count == 10 ) { console . warn ( `you have to many ${ Relax . displayName } component, May be effect performance!` ) ; } } , unwatch : Relax => { relaxCount [ Relax . displayName ] -- ; } } ;