How to use the @mapbox/batfish/modules/route-to.routeTo._setRouteToHandler function in @mapbox/batfish

To help you get started, we’ve selected a few @mapbox/batfish examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mapbox / batfish / src / webpack / router.js View on Github external
componentDidMount() {
    if (manageScrollRestoration) {
      scrollRestorer.start({ autoRestore: false });
    }

    const win = getWindow();
    if (!win.location.hash && manageScrollRestoration) {
      scrollRestorer.restoreScroll();
    } else {
      scrollToFragment();
    }

    routeTo._setRouteToHandler(this.routeTo);
    win.addEventListener('popstate', (event) => {
      event.preventDefault();
      changePage(
        {
          pathname: win.location.pathname,
          search: win.location.search,
          hash: win.location.hash
        },
        this.setState.bind(this)
      );
    });

    if (hijackLinks) {
      linkHijacker.hijack(
        {
          skipFilter: (link) =>