function(intent, isIntermediate) {

        var wasTransitioning = !!this.activeTransition;
        var oldState = wasTransitioning ? this.activeTransition.state : this.state;
        var newTransition;
        var router = this;

        try {
          var newState = intent.applyToState(oldState, this.recognizer, this.getHandler, isIntermediate);

          if (handlerInfosEqual(newState.handlerInfos, oldState.handlerInfos)) {

            // This is a no-op transition. See if query params changed.
            var queryParamChangelist = getChangelist(oldState.queryParams, newState.queryParams);
            if (queryParamChangelist) {

              // This is a little hacky but we need some way of storing
              // changed query params given that no activeTransition
              // is guaranteed to have occurred.
              this._changedQueryParams = queryParamChangelist.changed;
              trigger(this, newState.handlerInfos, true, ['queryParamsDidChange', queryParamChangelist.changed, queryParamChangelist.all, queryParamChangelist.removed]);
              this._changedQueryParams = null;

              if (!wasTransitioning && this.activeTransition) {
                // One of the handlers in queryParamsDidChange
                // caused a transition. Just return that transition.
                return this.activeTransition;
              } else {
                // Running queryParamsDidChange didn't change anything.
                // Just update query params and be on our way.
                oldState.queryParams = finalizeQueryParamChange(this, newState.handlerInfos, newState.queryParams);

                // We have to return a noop transition that will
                // perform a URL update at the end. This gives
                // the user the ability to set the url update
                // method (default is replaceState).
                newTransition = new Transition(this);
                newTransition.urlMethod = 'replace';
                newTransition.promise = newTransition.promise.then(function(result) {
                  updateURL(newTransition, oldState, true);
                  if (router.didTransition) {
                    router.didTransition(router.currentHandlerInfos);
                  }
                  return result;
                }, null, promiseLabel("Transition complete"));
                return newTransition;
              }
            }

            // No-op. No need to create a new transition.
            return new Transition(this);
          }

          if (isIntermediate) {
            setupContexts(this, newState);
            return;
          }

          // Create a new transition to the destination route.
          newTransition = new Transition(this, intent, newState);

          // Abort and usurp any previously active transition.
          if (this.activeTransition) {
            this.activeTransition.abort();
          }
          this.activeTransition = newTransition;

          // Transition promises by default resolve with resolved state.
          // For our purposes, swap out the promise to resolve
          // after the transition has been finalized.
          newTransition.promise = newTransition.promise.then(function(result) {
            return router.async(function() {
              return finalizeTransition(newTransition, result.state);
            }, "Finalize transition");
          }, null, promiseLabel("Settle transition promise when transition is finalized"));

          if (!wasTransitioning) {
            trigger(this, this.state.handlerInfos, true, ['willTransition', newTransition]);
          }

          return newTransition;
        } catch(e) {
          return new Transition(this, intent, null, e);
        }
      }
function(intent, isIntermediate) {

        var wasTransitioning = !!this.activeTransition;
        var oldState = wasTransitioning ? this.activeTransition.state : this.state;
        var newTransition;
        var router = this;

        try {
          var newState = intent.applyToState(oldState, this.recognizer, this.getHandler, isIntermediate);

          if (handlerInfosEqual(newState.handlerInfos, oldState.handlerInfos)) {

            
            var queryParamChangelist = getChangelist(oldState.queryParams, newState.queryParams);
            if (queryParamChangelist) {

              
              
              
              this._changedQueryParams = queryParamChangelist.changed;
              trigger(this, newState.handlerInfos, true, ['queryParamsDidChange', queryParamChangelist.changed, queryParamChangelist.all, queryParamChangelist.removed]);
              this._changedQueryParams = null;

              if (!wasTransitioning && this.activeTransition) {
                
                
                return this.activeTransition;
              } else {
                
                
                oldState.queryParams = finalizeQueryParamChange(this, newState.handlerInfos, newState.queryParams);

                
                
                
                
                newTransition = new Transition(this);
                newTransition.urlMethod = 'replace';
                newTransition.promise = newTransition.promise.then(function(result) {
                  updateURL(newTransition, oldState, true);
                  if (router.didTransition) {
                    router.didTransition(router.currentHandlerInfos);
                  }
                  return result;
                }, null, promiseLabel("Transition complete"));
                return newTransition;
              }
            }

            
            return new Transition(this);
          }

          if (isIntermediate) {
            setupContexts(this, newState);
            return;
          }

          
          newTransition = new Transition(this, intent, newState);

          
          if (this.activeTransition) {
            this.activeTransition.abort();
          }
          this.activeTransition = newTransition;

          
          
          
          newTransition.promise = newTransition.promise.then(function(result) {
            return router.async(function() {
              return finalizeTransition(newTransition, result.state);
            }, "Finalize transition");
          }, null, promiseLabel("Settle transition promise when transition is finalized"));

          if (!wasTransitioning) {
            trigger(this, this.state.handlerInfos, true, ['willTransition', newTransition]);
          }

          return newTransition;
        } catch(e) {
          return new Transition(this, intent, null, e);
        }
      }
function ( intent , isIntermediate ) { var wasTransitioning = ! ! this . activeTransition ; var oldState = wasTransitioning ? this . activeTransition . state : this . state ; var newTransition ; var router = this ; try { var newState = intent . applyToState ( oldState , this . recognizer , this . getHandler , isIntermediate ) ; if ( handlerInfosEqual ( newState . handlerInfos , oldState . handlerInfos ) ) { // This is a no-op transition. See if query params changed. var queryParamChangelist = getChangelist ( oldState . queryParams , newState . queryParams ) ; if ( queryParamChangelist ) { // This is a little hacky but we need some way of storing // changed query params given that no activeTransition // is guaranteed to have occurred. this . _changedQueryParams = queryParamChangelist . changed ; trigger ( this , newState . handlerInfos , true , [ 'queryParamsDidChange' , queryParamChangelist . changed , queryParamChangelist . all , queryParamChangelist . removed ] ) ; this . _changedQueryParams = null ; if ( ! wasTransitioning && this . activeTransition ) { // One of the handlers in queryParamsDidChange // caused a transition. Just return that transition. return this . activeTransition ; } else { // Running queryParamsDidChange didn't change anything. // Just update query params and be on our way. oldState . queryParams = finalizeQueryParamChange ( this , newState . handlerInfos , newState . queryParams ) ; // We have to return a noop transition that will // perform a URL update at the end. This gives // the user the ability to set the url update // method (default is replaceState). newTransition = new Transition ( this ) ; newTransition . urlMethod = 'replace' ; newTransition . promise = newTransition . promise . then ( function ( result ) { updateURL ( newTransition , oldState , true ) ; if ( router . didTransition ) { router . didTransition ( router . currentHandlerInfos ) ; } return result ; } , null , promiseLabel ( "Transition complete" ) ) ; return newTransition ; } } // No-op. No need to create a new transition. return new Transition ( this ) ; } if ( isIntermediate ) { setupContexts ( this , newState ) ; return ; } // Create a new transition to the destination route. newTransition = new Transition ( this , intent , newState ) ; // Abort and usurp any previously active transition. if ( this . activeTransition ) { this . activeTransition . abort ( ) ; } this . activeTransition = newTransition ; // Transition promises by default resolve with resolved state. // For our purposes, swap out the promise to resolve // after the transition has been finalized. newTransition . promise = newTransition . promise . then ( function ( result ) { return router . async ( function ( ) { return finalizeTransition ( newTransition , result . state ) ; } , "Finalize transition" ) ; } , null , promiseLabel ( "Settle transition promise when transition is finalized" ) ) ; if ( ! wasTransitioning ) { trigger ( this , this . state . handlerInfos , true , [ 'willTransition' , newTransition ] ) ; } return newTransition ; } catch ( e ) { return new Transition ( this , intent , null , e ) ; } }
NOTE: this doesn't really belong here, but here it shall remain until our ES6 transpiler can handle cyclical deps.
NOTE : this doesn t really belong here but here it shall remain until our ES6 transpiler can handle cyclical deps .