{"size": 994, "ext": "js", "max_stars_repo_path": "scripts/advarics/routing/client/client-router.js", "max_stars_repo_name": "brakmic/RactAmp", "max_stars_repo_stars_event_min_datetime": "2015-04-23T10:42:19.000Z", "max_stars_repo_stars_event_max_datetime": "2016-11-08T02:10:45.000Z", "max_issues_repo_path": "scripts/advarics/routing/client/client-router.js", "max_issues_repo_name": "brakmic/RactAmp", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/advarics/routing/client/client-router.js", "max_forks_repo_name": "brakmic/RactAmp", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 13, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.4871794872, "max_line_length": 57, "alphanum_fraction": 0.5814889336}
let page      = require('page');
import MenuLogic from '../../config/menu-logic.js';
//a simple client-side router based on PageJS
//more info: http://visionmedia.github.io/page.js/
export default class Router {
  constructor() {
      this.defaults  = window.app.defaults;
      this.basePath  = this.defaults.routing.basePath;
      this.menuLogic = MenuLogic;
      this.configureEvents();
  }
  start() {
      page.base(this.basePath);
      page('/:selection', (ctx) => {
          this.activatePath(ctx.params.selection);
      });
      page();
  }
  //analyze url-elements and find matching route
  activatePath(selection) {
      this.menuLogic.activate(selection);
  }
  stop() {
      page.stop();
  }
  configureEvents() {
      var that = this;
      //sidebar-logo
      var logo = document.querySelector('.sidebar-logo');
      if (logo) {
          logo.addEventListener('click', (e) => {
              page('/');
              e.preventDefault();
          });
      }

  }
}
