How to use the flux/routes.js.home function in flux

To help you get started, we’ve selected a few flux 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 ustwo / ustwo.com-frontend / src / node_modules / flux / router.js View on Github external
function init (initialUrl) {
  const vurl = virtualUrl(initialUrl || window.location.href);

  window.onpopstate = () => {
    let url = window.location.href;
    if(window.location.href.indexOf('#') > -1) {
      url = window.location.hash.substr(1);
    }
    Router.navigate(url, true, true);
  };

  if (!RoutePattern.fromString(routes.home.pattern).matches(vurl.pathname)) {
    Router.navigate(vurl.original, false, false, true, true);
  } else {
    setUrl(vurl.original, true);
    routes.home.handler(vurl.searchObject);
  }
}
github ustwo / ustwo.com-frontend / src / node_modules / flux / router.js View on Github external
function init (initialUrl) {
  const vurl = virtualUrl(initialUrl || window.location.href);

  window.onpopstate = () => {
    let url = window.location.href;
    if(window.location.href.indexOf('#') > -1) {
      url = window.location.hash.substr(1);
    }
    Router.navigate(url, true, true);
  };

  if (!RoutePattern.fromString(routes.home.pattern).matches(vurl.pathname)) {
    Router.navigate(vurl.original, false, false, true, true);
  } else {
    setUrl(vurl.original, true);
    routes.home.handler(vurl.searchObject);
  }
}