function(endType) {

        function watchEnd(link, end) {

            end = end || {};

            var previousEnd = link.previous(endType) || {};

            // Pick updateMethod this._sourceBboxUpdate or this._targetBboxUpdate.
            var updateEndFunction = this['_' + endType + 'BBoxUpdate'];

            if (this._isModel(previousEnd)) {
                this.stopListening(this.paper.getModelById(previousEnd.id), 'change', updateEndFunction);
            }

            if (this._isModel(end)) {
                // If the observed model changes, it caches a new bbox and do the link update.
                this.listenTo(this.paper.getModelById(end.id), 'change', updateEndFunction);
            }

            _.bind(updateEndFunction, this)({ cacheOnly: true });

            return this;
        }

        return watchEnd;
    }
function(endType) {

        function watchEnd(link, end) {

            end = end || {};

            var previousEnd = link.previous(endType) || {};

            
            var updateEndFunction = this['_' + endType + 'BBoxUpdate'];

            if (this._isModel(previousEnd)) {
                this.stopListening(this.paper.getModelById(previousEnd.id), 'change', updateEndFunction);
            }

            if (this._isModel(end)) {
                
                this.listenTo(this.paper.getModelById(end.id), 'change', updateEndFunction);
            }

            _.bind(updateEndFunction, this)({ cacheOnly: true });

            return this;
        }

        return watchEnd;
    }
function ( endType ) { function watchEnd ( link , end ) { end = end || { } ; var previousEnd = link . previous ( endType ) || { } ; // Pick updateMethod this._sourceBboxUpdate or this._targetBboxUpdate. var updateEndFunction = this [ '_' + endType + 'BBoxUpdate' ] ; if ( this . _isModel ( previousEnd ) ) { this . stopListening ( this . paper . getModelById ( previousEnd . id ) , 'change' , updateEndFunction ) ; } if ( this . _isModel ( end ) ) { // If the observed model changes, it caches a new bbox and do the link update. this . listenTo ( this . paper . getModelById ( end . id ) , 'change' , updateEndFunction ) ; } _ . bind ( updateEndFunction , this ) ( { cacheOnly : true } ) ; return this ; } return watchEnd ; }
Returns a function observing changes on an end of the link. If a change happens and new end is a new model, it stops listening on the previous one and starts listening to the new one.
Returns a function observing changes on an end of the link . If a change happens and new end is a new model it stops listening on the previous one and starts listening to the new one .