Bind all defined routes to `Backbone.history`. We have to reverse the order of the routes here to support behavior where the most general routes can be defined at the bottom of the route map.
342410
function() {
      if (!this.routes) return;
      this.routes = _.result(this, 'routes');
      var route, routes = _.keys(this.routes);
      while ((route = routes.pop()) != null) {
        this.route(route, this.routes[route]);
      }
    }
1298918
public void setHistory(@NonNull final History history, @NonNull final Direction direction) {
    move(new PendingTraversal() {
      @Override void doExecute() {
        dispatch(preserveEquivalentPrefix(getHistory(), history), direction);
      }
    });
  }
1264005
def put(self, route: str(), callback: object()):
        
        self.__set_route('put', {route: callback})
        return RouteMapping
986642
def get_history(self):
        """"""
        self.load_history()
        return map(lambda x: (x, self.history[x]), self.ordered_history)
336614
@Bind(aggregate = true, optional = true)
    public synchronized void bindController(Controller controller) {
        LOGGER.info("Adding routes from " + controller);

        List<Route> newRoutes = new ArrayList<>();
        try {

            List<Route> annotatedNewRoutes = RouteUtils.collectRouteFromControllerAnnotations(controller);
            newRoutes.addAll(annotatedNewRoutes);
            newRoutes.addAll(controller.routes());

            //check if these new routes don't pre-exist
            ensureNoConflicts(newRoutes);

        } catch (RoutingException e) {
            LOGGER.error("The controller {} declares routes conflicting with existing routes, " +
                    "the controller is ignored, reason: {}", controller, e.getMessage(), e);
            // remove all new routes as one has failed
            routes.removeAll(newRoutes);  //NOSONAR
        } catch (Exception e) {
            LOGGER.error("The controller {} declares invalid routes, " +
                    "the controller is ignored, reason: {}", controller, e.getMessage(), e);
            // remove all new routes as one has failed
            routes.removeAll(newRoutes); //NOSONAR
        }
    }
232536
function(fragment, options={}) {

    // Default trigger to true unless otherwise specified
    (options.trigger === undefined) && (options.trigger = true);

    // Stringify any data passed in the options hash
    var query = options.data ? (~fragment.indexOf('?') ? '&' : '?') + $.url.query.stringify(options.data) : '';

    // Un-Mark any `active` links in the page container
    var $container = $(this.config.containers).unMarkLinks();

    // Navigate to the specified path. Return value is the value from the router
    // callback specified on the component
    var resp = Backbone.history.navigate(fragment + query, options);

    // Always return a promise. If the response of `Backbone.histroy.navigate`
    // was a promise, wait for it to resolve before resolving. Once resolved,
    // mark relevent links on the page as `active`.
    return new Promise(function(resolve, reject) {
      if(resp && resp.constructor === Promise) resp.then(resolve, resolve);
      resolve(resp);
    }).then(function(resp){
      $container.markLinks();
      return resp;
    });
  }
338912
function() {
                    if (!can.route.currentBinding) {
                        can.route._call("bind");
                        can.route.bind("change", onRouteDataChange);
                        can.route.currentBinding = can.route.defaultBinding;
                    }
                }
287601
function(s){
      var currentState = history[historyIndex];
      if(typeof s === 'function'){
        s = s( history[historyIndex].toJS() );
      }

      var newState = currentState.merge(s);
      history = history.slice(0,historyIndex + 1);
      history.push(newState);
      historyIndex++;
      return new Immutable.Map(history[historyIndex]).toJS();
    }
1322634
function controllerLinks(route, controllerAction, reverseRouteService) {
  const controllers = sails.controllers;
  const controller = _.first(controllerAction.split('.'));
  const path = route.path;
  const actions = _.get(controllers[controller], '_config.links') || [];
  let result = {};
  result[path] = [];
  _.each(actions, function (action) {
    return result[path].push({
      rel: action,
      link: reverseRouteService({controller: controller + '.' + action, args: []}, false)
    });
  });
  return result;
}
162796
function _processRoute(siteDesc, prefix, options) {
    options = options || {};
    //if (siteDesc.roles !== undefined && siteDesc.url !== undefined)
    //console.log('route', siteDesc.url, 'prefix', prefix);

    if (userHelper.hasRole(siteDesc.roles)) {
        let route = {
            roles: siteDesc.roles,
            name: prefix,
            route: siteDesc.url,
            regex: routeToRegExp(siteDesc.url),
            requiredParams: siteDesc.requiredParams
        };
        //Call the Backbone.history.handlers....
        //console.log('*****************');
        //console.log('ROute name: ',route.route);
        //console.log('Route handler name : ',  findRouteName(route.route.substring(1)));
        routes[findRouteName(route.route.substring(1))] = route;
        if (options.isInSiteStructure) {
            siteStructure[prefix] = route;
        }
    }
}
828418
function() {
        var hist = $.mobile.navigate.history;

        if ( this._isCloseable ) {
            this._isCloseable = false;
            // If the hash listening is enabled and there is at least one preceding history
            // entry it's ok to go back. Initial pages with the dialog hash state are an example
            // where the stack check is necessary
            if ( $.mobile.hashListeningEnabled && hist.activeIndex > 0 ) {
                $.mobile.back();
            } else {
                $.mobile.pageContainer.pagecontainer( "back" );
            }
        }
    }
923874
function transformRoutes(routes) {
  if (typeof routes !== 'object') {
    throw new Error('Invalid route config');
  }
  var config = clone(routes);

  return Object.keys(config).map(function(name){
    var opt = config[name];
    // sugar for specifying fn
    if (typeof opt === 'function') {
      opt = {
        view: opt
      };
    } else if (typeof opt !== 'object') {
      throw new Error('Invalid route config for ' + name);
    }

    var defaultRoute = opt.defaultChild ? DefaultRoute({
      key: (opt.defaultChild.key || name + 'Default'),
      name: (opt.defaultChild.name || name + 'Default'),
      handler: opt.defaultChild.view
    }) : null;

    var notFoundRoute = opt.childNotFound ? NotFoundRoute({
      key: (opt.childNotFound.key || name + 'NotFound'),
      name: (opt.childNotFound.name || name + 'NotFound'),
      handler: opt.childNotFound.view
    }) : null;

    var children = (opt.children ? transformRoutes(opt.children) : []);
    if (defaultRoute) {
      children.push(defaultRoute);
    }
    if (notFoundRoute) {
      children.push(notFoundRoute);
    }
    return Route({
      key: name,
      name: name,
      path: opt.path,
      handler: opt.view
    }, children);
  });
}
525114
protected void setHistoryEnabled (boolean historyEnabled)
    {
        if (historyEnabled && _historyModel == null) {
            _historyModel = _scrollbar.getModel();
            _historyModel.addChangeListener(this);
            resetHistoryOffset();

            // out with the subtitles, we'll be displaying history
            clearGlyphs(_subtitles);

            // "scroll" down to the latest history entry
            updateHistBar(_history.size() - 1);

            // refigure our history
            figureCurrentHistory();

        } else if (!historyEnabled && _historyModel != null) {
            _historyModel.removeChangeListener(this);
            _historyModel = null;

            // out with the history, we'll be displaying subtitles
            clearGlyphs(_showingHistory);
        }
    }
639445
function listen(listener) {
    // TODO: Only use a single history listener. Otherwise we'll
    // end up with multiple concurrent calls to match.
    return history.listen(function (location) {
      if (state.location === location) {
        listener(null, state)
      } else {
        match(location, function (error, redirectLocation, nextState) {
          if (error) {
            listener(error)
          } else if (redirectLocation) {
            history.transitionTo(redirectLocation)
          } else if (nextState) {
            listener(null, nextState)
          } else {
            warning(
              false,
              'Location "%s" did not match any routes',
              location.pathname + location.search + location.hash
            )
          }
        })
      }
    })
  }
963034
public void setHistory(java.util.Collection<ConfigurationId> history) {
        if (history == null) {
            this.history = null;
            return;
        }

        this.history = new java.util.ArrayList<ConfigurationId>(history);
    }
557421
function historyDirective($scope, History, Clients) {

        var ctrl = this;

        ctrl.visited = [];

        ctrl.utils = {};

        ctrl.utils.localUrl = function (path) {
            return [$scope.options.urls.local, path].join("");
        };

        ctrl.updateVisited = function (data) {
            ctrl.visited = data;
            $scope.$digest();
        };

        ctrl.sendAllTo = function (url) {
            url.success = true;
            Clients.sendAllTo(url.path);
            setTimeout(function () {
                url.success = false;
                $scope.$digest();
            }, 1000);
        };

        ctrl.removeVisited = function (item) {
            History.remove(item);
        };

        History.get().then(function (items) {
            ctrl.visited = items;
        });

        History.on("change", ctrl.updateVisited);

        $scope.$on("$destroy", function () {
            History.off(ctrl.updateVisited);
        });
    }
124894
function findRouteName(routeToTest) {
    if (!window.Backbone) {
        throw new Error('Dependency: Backbone is missing.');
    }
    let handlers = window.Backbone.history.handlers;
    //console.log('handlers', )
    let h = find(handlers, function (handler) {
        return handler.route.test(routeToTest);
    });
    if (h !== undefined) {
        return h.route.toString();
    }
    return some(handlers, function (handler) {
        if (handler.route.test(routeToTest)) {
            return handler.route.toString();
        }
    });
}