flux-router-component
Advanced tools
Comparing version 0.5.3 to 0.5.4
@@ -11,5 +11,6 @@ /** | ||
var History = require('./History'); | ||
var EVT_CLICK = 'click'; | ||
var EVT_PAGELOAD = 'pageload'; | ||
var EVT_POPSTATE = 'popstate'; | ||
var TYPE_CLICK = 'click'; | ||
var TYPE_PAGELOAD = 'pageload'; | ||
var TYPE_POPSTATE = 'popstate'; | ||
var TYPE_DEFAULT = 'default'; // default value if navigation type is missing, for programmatic navigation | ||
var RouterMixin; | ||
@@ -58,3 +59,3 @@ | ||
setImmediate(function navigateToActualRoute() { | ||
context.executeAction(navigateAction, {type: EVT_PAGELOAD, url: urlFromHistory}); | ||
context.executeAction(navigateAction, {type: TYPE_PAGELOAD, url: urlFromHistory}); | ||
}); | ||
@@ -69,3 +70,3 @@ } | ||
if (url !== self.state.route.url) { | ||
context.executeAction(navigateAction, {type: EVT_POPSTATE, url: url, params: (e.state && e.state.params)}); | ||
context.executeAction(navigateAction, {type: TYPE_POPSTATE, url: url, params: (e.state && e.state.params)}); | ||
} | ||
@@ -107,7 +108,9 @@ } | ||
var nav = newState.route.navigate; | ||
var navType = (nav && nav.type) || TYPE_DEFAULT; | ||
var historyState; | ||
switch (nav.type) { | ||
case EVT_CLICK: | ||
historyState = {params: (nav.params || {})}; | ||
switch (navType) { | ||
case TYPE_CLICK: | ||
case TYPE_DEFAULT: | ||
historyState = {params: (nav && nav.params) || {}}; | ||
if (this._enableScroll) { | ||
@@ -120,3 +123,3 @@ window.scrollTo(0, 0); | ||
break; | ||
case EVT_POPSTATE: | ||
case TYPE_POPSTATE: | ||
if (this._enableScroll) { | ||
@@ -123,0 +126,0 @@ historyState = (this._history.getState && this._history.getState()) || {}; |
{ | ||
"name": "flux-router-component", | ||
"version": "0.5.3", | ||
"version": "0.5.4", | ||
"description": "Router-related React component and mixin for applications with Flux architecture", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
36208
506