Comparing version 6.0.2 to 6.0.3
@@ -17,2 +17,3 @@ import RouteRecognizer, { MatchCallback } from 'route-recognizer'; | ||
export default abstract class Router<T extends Route> { | ||
private _lastQueryParams; | ||
log?: (message: string) => void; | ||
@@ -19,0 +20,0 @@ state?: TransitionState<T>; |
@@ -47,2 +47,3 @@ 'use strict'; | ||
this._lastQueryParams = {}; | ||
this.state = undefined; | ||
@@ -105,3 +106,3 @@ this.oldState = undefined; | ||
newTransition[_transition.QUERY_PARAMS_SYMBOL] = newState.queryParams; | ||
this.toReadOnlyInfos(newTransition, newState.routeInfos); | ||
this.toReadOnlyInfos(newTransition, newState); | ||
this.routeWillChange(newTransition); | ||
@@ -193,3 +194,3 @@ newTransition.promise = newTransition.promise.then(function (result) { | ||
} | ||
this.toReadOnlyInfos(newTransition, newState.routeInfos); | ||
this.toReadOnlyInfos(newTransition, newState); | ||
// Abort and usurp any previously active transition. | ||
@@ -589,6 +590,7 @@ if (this.activeTransition) { | ||
key: 'toReadOnlyInfos', | ||
value: function toReadOnlyInfos(newTransition, newRouteInfos) { | ||
value: function toReadOnlyInfos(newTransition, newState) { | ||
var oldRouteInfos = this.state.routeInfos; | ||
this.fromInfos(newTransition, oldRouteInfos); | ||
this.toInfos(newTransition, newRouteInfos); | ||
this.toInfos(newTransition, newState.routeInfos); | ||
this._lastQueryParams = newState.queryParams; | ||
} | ||
@@ -599,3 +601,3 @@ }, { | ||
if (oldRouteInfos.length > 0) { | ||
var fromInfos = (0, _routeInfo.toReadOnlyRouteInfo)(oldRouteInfos, newTransition[_transition.QUERY_PARAMS_SYMBOL]); | ||
var fromInfos = (0, _routeInfo.toReadOnlyRouteInfo)(oldRouteInfos, Object.assign({}, this._lastQueryParams)); | ||
newTransition.from = fromInfos[fromInfos.length - 1] || null; | ||
@@ -608,3 +610,3 @@ } | ||
if (newRouteInfos.length > 0) { | ||
var toInfos = (0, _routeInfo.toReadOnlyRouteInfo)(newRouteInfos, newTransition[_transition.QUERY_PARAMS_SYMBOL]); | ||
var toInfos = (0, _routeInfo.toReadOnlyRouteInfo)(newRouteInfos, Object.assign({}, newTransition[_transition.QUERY_PARAMS_SYMBOL])); | ||
newTransition.to = toInfos[toInfos.length - 1] || null; | ||
@@ -611,0 +613,0 @@ } |
@@ -17,2 +17,3 @@ import RouteRecognizer, { MatchCallback } from 'route-recognizer'; | ||
export default abstract class Router<T extends Route> { | ||
private _lastQueryParams; | ||
log?: (message: string) => void; | ||
@@ -19,0 +20,0 @@ state?: TransitionState<T>; |
@@ -12,2 +12,3 @@ import RouteRecognizer from 'route-recognizer'; | ||
constructor(logger) { | ||
this._lastQueryParams = {}; | ||
this.state = undefined; | ||
@@ -63,3 +64,3 @@ this.oldState = undefined; | ||
newTransition[QUERY_PARAMS_SYMBOL] = newState.queryParams; | ||
this.toReadOnlyInfos(newTransition, newState.routeInfos); | ||
this.toReadOnlyInfos(newTransition, newState); | ||
this.routeWillChange(newTransition); | ||
@@ -141,3 +142,3 @@ newTransition.promise = newTransition.promise.then((result) => { | ||
} | ||
this.toReadOnlyInfos(newTransition, newState.routeInfos); | ||
this.toReadOnlyInfos(newTransition, newState); | ||
// Abort and usurp any previously active transition. | ||
@@ -535,10 +536,11 @@ if (this.activeTransition) { | ||
} | ||
toReadOnlyInfos(newTransition, newRouteInfos) { | ||
toReadOnlyInfos(newTransition, newState) { | ||
let oldRouteInfos = this.state.routeInfos; | ||
this.fromInfos(newTransition, oldRouteInfos); | ||
this.toInfos(newTransition, newRouteInfos); | ||
this.toInfos(newTransition, newState.routeInfos); | ||
this._lastQueryParams = newState.queryParams; | ||
} | ||
fromInfos(newTransition, oldRouteInfos) { | ||
if (oldRouteInfos.length > 0) { | ||
let fromInfos = toReadOnlyRouteInfo(oldRouteInfos, newTransition[QUERY_PARAMS_SYMBOL]); | ||
let fromInfos = toReadOnlyRouteInfo(oldRouteInfos, Object.assign({}, this._lastQueryParams)); | ||
newTransition.from = fromInfos[fromInfos.length - 1] || null; | ||
@@ -549,3 +551,3 @@ } | ||
if (newRouteInfos.length > 0) { | ||
let toInfos = toReadOnlyRouteInfo(newRouteInfos, newTransition[QUERY_PARAMS_SYMBOL]); | ||
let toInfos = toReadOnlyRouteInfo(newRouteInfos, Object.assign({}, newTransition[QUERY_PARAMS_SYMBOL])); | ||
newTransition.to = toInfos[toInfos.length - 1] || null; | ||
@@ -552,0 +554,0 @@ } |
{ | ||
"name": "router_js", | ||
"version": "6.0.2", | ||
"version": "6.0.3", | ||
"description": | ||
@@ -5,0 +5,0 @@ "A lightweight JavaScript library is built on top of route-recognizer and rsvp.js to provide an API for handling routes", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
368148
5334