lib/mux.js
function _subInstance (target, props, kp) {

        var ins
        var _mux = target.__mux__
        if (_mux && _mux.__kp__ === kp && _mux.__root__ === __muxid__) {
            // reuse
            ins = target
            // emitter proxy
            ins._$emitter(emitter)
            // a private emitter for communication between instances
            ins._$_emitter(_emitter)
        } else {
            ins = new Mux({
                props: props,
                emitter: emitter, 
                _emitter: _emitter,
                __kp__: kp
            })
        }
        if (!ins.__root__) {
            $util.def(ins, '__root__', {
                enumerable: false,
                value: __muxid__
            })
        }
        return ins
    }
function _subInstance (target, props, kp) {

        var ins
        var _mux = target.__mux__
        if (_mux && _mux.__kp__ === kp && _mux.__root__ === __muxid__) {
            // reuse
            ins = target
            // emitter proxy
            ins._$emitter(emitter)
            // a private emitter for communication between instances
            ins._$_emitter(_emitter)
        } else {
            ins = new Mux({
                props: props,
                emitter: emitter, 
                _emitter: _emitter,
                __kp__: kp
            })
        }
        if (!ins.__root__) {
            $util.def(ins, '__root__', {
                enumerable: false,
                value: __muxid__
            })
        }
        return ins
    }
function _subInstance ( target , props , kp ) { var ins var _mux = target . __mux__ if ( _mux && _mux . __kp__ === kp && _mux . __root__ === __muxid__ ) { // reuse ins = target // emitter proxy ins . _$emitter ( emitter ) // a private emitter for communication between instances ins . _$_emitter ( _emitter ) } else { ins = new Mux ( { props : props , emitter : emitter , _emitter : _emitter , __kp__ : kp } ) } if ( ! ins . __root__ ) { $util . def ( ins , '__root__' , { enumerable : false , value : __muxid__ } ) } return ins }
Instance or reuse a sub-mux-instance with specified keyPath and emitter
@param target <Object> instance target, it could be a Mux instance
@param props <Object> property value that has been walked
@param kp <String> keyPath of target, use to diff instance keyPath changes or instance with the keyPath
Instance or reuse a sub - mux - instance with specified keyPath and emitter