Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

App.run('#/') doesn't actually changes window hash? #252

Open
jumangee opened this issue Apr 16, 2016 · 0 comments
Open

App.run('#/') doesn't actually changes window hash? #252

jumangee opened this issue Apr 16, 2016 · 0 comments

Comments

@jumangee
Copy link

App.run('#/') doesn't actually changes window hash?

Example:

  1. do something with app, hash changes to ..../index.html#/open/
  2. do page reload
  3. hash doesn't changes and app open route #/open/, but should - #/
require(['jquery','sammy','mainapp','bootstrap','mustache_plugin'], function($, Sammy, App) {
  $(document).ready(function() {    
    App.init();
    App.log('Start');
    App.run('#/');    
  }); 
});
...
app = Sammy('#container', function theCharsheetApp() {
      var localGameDefs = ['fabled']; // should be stored in db
      var currentGame = 'fabled';
      var gameinfo = null;
      var self = this;
      var currentPage = null;

      var locale = [];
      var templates = {};

      this.init = function() {
        //this.setLocation('#/');

        this.use('Mustache','ms.html');

        for (var path in defaultControllers) {
          if (!defaultControllers.hasOwnProperty(path)) continue;    
          (function(p, n) {
            self.log('app::bind ' + p + ' to ' + n);
            self.get(p, function()  {
              var etx = this;
              self.log('load controller ' + n);
              require(['app/controller/' + n], function(page) {
                self.log(page);
                self.log('app::controller ' + n + ' open');
                if (currentPage && currentPage.hide) {
                  currentPage.hide(etx);
                }
                return;
                page.show.apply(etx);
                currentPage = page;
              });
            })
          })(path, defaultControllers[path]);
        }

      }
...

Log:
app::bind #/ to default
app::bind #/setup to setup
app::bind #/gamelist to gamelist
app::bind #/loadgame to loadgame
app::bind #/cs/:num/:group to charsheet
app::bind #/open/:name to opengame
Start
load controller opengame
app::controller opengame open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant