src/basis/router.js
function checkUrl(){
    var newPath = location.hash.substr(1) || '';

    if (newPath != currentPath)
    {
      // check for recursion
      if (preventRecursion(newPath))
        return;

      // save current path
      currentPath = newPath;

      var routesToLeave = [];
      var routesToEnter = [];
      var routesToMatch = [];

      allRoutes.forEach(function(route){
        var flags = route.processLocation_(newPath);

        if (flags & ROUTE_LEAVE)
          routesToLeave.push(route);
        if (flags & ROUTE_ENTER)
          routesToEnter.push(route);
        if (flags & ROUTE_MATCH)
          routesToMatch.push(route);
      });

      for (var i = 0; i < routesToLeave.length; i++)
        routeLeave(routesToLeave[i]);

      for (var i = 0; i < routesToEnter.length; i++)
        routeEnter(routesToEnter[i]);

      for (var i = 0; i < routesToMatch.length; i++)
        routeMatch(routesToMatch[i]);

      /** @cut */ flushLog(namespace + ': hash changed to "' + newPath + '"');
    }
    else
    {
      allRoutes.forEach(function(route){
        if (route.value)
        {
          routeEnter(route, true);
          routeMatch(route, true);
        }
      });

      /** @cut */ flushLog(namespace + ': checkUrl()');
    }
  }
function checkUrl(){
    var newPath = location.hash.substr(1) || '';

    if (newPath != currentPath)
    {
      // check for recursion
      if (preventRecursion(newPath))
        return;

      // save current path
      currentPath = newPath;

      var routesToLeave = [];
      var routesToEnter = [];
      var routesToMatch = [];

      allRoutes.forEach(function(route){
        var flags = route.processLocation_(newPath);

        if (flags & ROUTE_LEAVE)
          routesToLeave.push(route);
        if (flags & ROUTE_ENTER)
          routesToEnter.push(route);
        if (flags & ROUTE_MATCH)
          routesToMatch.push(route);
      });

      for (var i = 0; i < routesToLeave.length; i++)
        routeLeave(routesToLeave[i]);

      for (var i = 0; i < routesToEnter.length; i++)
        routeEnter(routesToEnter[i]);

      for (var i = 0; i < routesToMatch.length; i++)
        routeMatch(routesToMatch[i]);

      /** @cut */ flushLog(namespace + ': hash changed to "' + newPath + '"');
    }
    else
    {
      allRoutes.forEach(function(route){
        if (route.value)
        {
          routeEnter(route, true);
          routeMatch(route, true);
        }
      });

      /** @cut */ flushLog(namespace + ': checkUrl()');
    }
  }
function checkUrl ( ) { var newPath = location . hash . substr ( 1 ) || '' ; if ( newPath != currentPath ) { // check for recursion if ( preventRecursion ( newPath ) ) return ; // save current path currentPath = newPath ; var routesToLeave = [ ] ; var routesToEnter = [ ] ; var routesToMatch = [ ] ; allRoutes . forEach ( function ( route ) { var flags = route . processLocation_ ( newPath ) ; if ( flags & ROUTE_LEAVE ) routesToLeave . push ( route ) ; if ( flags & ROUTE_ENTER ) routesToEnter . push ( route ) ; if ( flags & ROUTE_MATCH ) routesToMatch . push ( route ) ; } ) ; for ( var i = 0 ; i < routesToLeave . length ; i ++ ) routeLeave ( routesToLeave [ i ] ) ; for ( var i = 0 ; i < routesToEnter . length ; i ++ ) routeEnter ( routesToEnter [ i ] ) ; for ( var i = 0 ; i < routesToMatch . length ; i ++ ) routeMatch ( routesToMatch [ i ] ) ; /** @cut */ flushLog ( namespace + ': hash changed to "' + newPath + '"' ) ; } else { allRoutes . forEach ( function ( route ) { if ( route . value ) { routeEnter ( route , true ) ; routeMatch ( route , true ) ; } } ) ; /** @cut */ flushLog ( namespace + ': checkUrl()' ) ; } }
Process current location
Process current location