fixed missing ifmounted bug / fixed getting item when navigating directly to page

This commit is contained in:
Senad Uka
2015-01-28 05:04:45 +01:00
parent f27c29fccf
commit f8b3ef3a64
9 changed files with 109 additions and 92 deletions

View File

@@ -8,6 +8,17 @@ var _ = require('underscore');
// Extend ItemStore with EventEmitter to add eventing capabilities
var NavigationStore = _.extend({}, EventEmitter.prototype, {
getItemIdFromUrl: function () {
// ugly but it seems to me that
// router does not want to expose its
// state
var url = document.URL;
var itemIdRegex = /artikal\/(\d+)\//;
var match = itemIdRegex.exec(url);
console.log(match);
return match[0];
},
// Emit Change event
emitChange: function() {
console.log("NavigationStore change!");