@ngrx/router-store
Advanced tools
Comparing version 4.0.3 to 4.0.4
@@ -44,2 +44,3 @@ import { NgModule } from '@angular/core'; | ||
/** | ||
* @template T | ||
* @param {?} state | ||
@@ -188,8 +189,3 @@ * @param {?} action | ||
routerState: this.routerState, | ||
event: /** @type {?} */ ({ | ||
id: this.lastRoutesRecognized.id, | ||
url: this.lastRoutesRecognized.url, | ||
urlAfterRedirects: this.lastRoutesRecognized.urlAfterRedirects, | ||
state: this.serializer.serialize(this.routerState), | ||
}), | ||
event: new RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerState), | ||
}); | ||
@@ -196,0 +192,0 @@ }; |
@@ -40,2 +40,3 @@ import { NgModule } from '@angular/core'; | ||
/** | ||
* @template T | ||
* @param {?} state | ||
@@ -181,8 +182,3 @@ * @param {?} action | ||
routerState: this.routerState, | ||
event: /** @type {?} */ ({ | ||
id: this.lastRoutesRecognized.id, | ||
url: this.lastRoutesRecognized.url, | ||
urlAfterRedirects: this.lastRoutesRecognized.urlAfterRedirects, | ||
state: this.serializer.serialize(this.routerState), | ||
}), | ||
event: new RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerState), | ||
}); | ||
@@ -189,0 +185,0 @@ } |
@@ -46,2 +46,3 @@ (function (global, factory) { | ||
/** | ||
* @template T | ||
* @param {?} state | ||
@@ -190,8 +191,3 @@ * @param {?} action | ||
routerState: this.routerState, | ||
event: /** @type {?} */ ({ | ||
id: this.lastRoutesRecognized.id, | ||
url: this.lastRoutesRecognized.url, | ||
urlAfterRedirects: this.lastRoutesRecognized.urlAfterRedirects, | ||
state: this.serializer.serialize(this.routerState), | ||
}), | ||
event: new _angular_router.RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerState), | ||
}); | ||
@@ -198,0 +194,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/router"),require("@ngrx/store"),require("rxjs/observable/of")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/router","@ngrx/store","rxjs/observable/of"],e):e((t.ngrx=t.ngrx||{},t.ngrx.routerStore=t.ngrx.routerStore||{}),t.ng.core,t.ng.router,t.ngrx.store,t.Rx.Observable)}(this,function(t,e,r,o,i){"use strict";function s(t,e){switch(e.type){case u:case h:case c:return{state:e.payload.routerState,navigationId:e.payload.event.id};default:return t}}var a=function(){function t(){}return t.prototype.serialize=function(t){},t}(),n=function(){function t(){}return t.prototype.serialize=function(t){return t},t}(),u="ROUTER_NAVIGATION",c="ROUTER_CANCEL",h="ROUTE_ERROR",p=function(){function t(t,e,r){this.store=t,this.router=e,this.serializer=r,this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1,this.setUpBeforePreactivationHook(),this.setUpStoreStateListener(),this.setUpStateRollbackEvents()}return t.prototype.setUpBeforePreactivationHook=function(){var t=this;this.router.hooks.beforePreactivation=function(e){return t.routerState=t.serializer.serialize(e),t.shouldDispatchRouterNavigation()&&t.dispatchRouterNavigation(),i.of(!0)}},t.prototype.setUpStoreStateListener=function(){var t=this;this.store.subscribe(function(e){t.storeState=e,t.navigateIfNeeded()})},t.prototype.shouldDispatchRouterNavigation=function(){return!this.storeState.routerReducer||!this.navigationTriggeredByDispatch},t.prototype.navigateIfNeeded=function(){this.storeState.routerReducer&&this.storeState.routerReducer.state&&(this.dispatchTriggeredByRouter||this.router.url!==this.storeState.routerReducer.state.url&&(this.navigationTriggeredByDispatch=!0,this.router.navigateByUrl(this.storeState.routerReducer.state.url)))},t.prototype.setUpStateRollbackEvents=function(){var t=this;this.router.events.subscribe(function(e){e instanceof r.RoutesRecognized?t.lastRoutesRecognized=e:e instanceof r.NavigationCancel?t.dispatchRouterCancel(e):e instanceof r.NavigationError&&t.dispatchRouterError(e)})},t.prototype.dispatchRouterNavigation=function(){this.dispatchRouterAction(u,{routerState:this.routerState,event:{id:this.lastRoutesRecognized.id,url:this.lastRoutesRecognized.url,urlAfterRedirects:this.lastRoutesRecognized.urlAfterRedirects,state:this.serializer.serialize(this.routerState)}})},t.prototype.dispatchRouterCancel=function(t){this.dispatchRouterAction(c,{routerState:this.routerState,storeState:this.storeState,event:t})},t.prototype.dispatchRouterError=function(t){this.dispatchRouterAction(h,{routerState:this.routerState,storeState:this.storeState,event:t})},t.prototype.dispatchRouterAction=function(t,e){this.dispatchTriggeredByRouter=!0;try{this.store.dispatch({type:t,payload:e})}finally{this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1}},t}();p.decorators=[{type:e.NgModule,args:[{providers:[{provide:a,useClass:n}]}]}],p.ctorParameters=function(){return[{type:o.Store},{type:r.Router},{type:a}]},t.ROUTER_ERROR=h,t.ROUTER_CANCEL=c,t.ROUTER_NAVIGATION=u,t.routerReducer=s,t.StoreRouterConnectingModule=p,t.RouterStateSerializer=a,t.DefaultRouterStateSerializer=n,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("@angular/core"),require("@angular/router"),require("@ngrx/store"),require("rxjs/observable/of")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@angular/router","@ngrx/store","rxjs/observable/of"],e):e((t.ngrx=t.ngrx||{},t.ngrx.routerStore=t.ngrx.routerStore||{}),t.ng.core,t.ng.router,t.ngrx.store,t.Rx.Observable)}(this,function(t,e,r,o,i){"use strict";function s(t,e){switch(e.type){case u:case p:case c:return{state:e.payload.routerState,navigationId:e.payload.event.id};default:return t}}var a=function(){function t(){}return t.prototype.serialize=function(t){},t}(),n=function(){function t(){}return t.prototype.serialize=function(t){return t},t}(),u="ROUTER_NAVIGATION",c="ROUTER_CANCEL",p="ROUTE_ERROR",h=function(){function t(t,e,r){this.store=t,this.router=e,this.serializer=r,this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1,this.setUpBeforePreactivationHook(),this.setUpStoreStateListener(),this.setUpStateRollbackEvents()}return t.prototype.setUpBeforePreactivationHook=function(){var t=this;this.router.hooks.beforePreactivation=function(e){return t.routerState=t.serializer.serialize(e),t.shouldDispatchRouterNavigation()&&t.dispatchRouterNavigation(),i.of(!0)}},t.prototype.setUpStoreStateListener=function(){var t=this;this.store.subscribe(function(e){t.storeState=e,t.navigateIfNeeded()})},t.prototype.shouldDispatchRouterNavigation=function(){return!this.storeState.routerReducer||!this.navigationTriggeredByDispatch},t.prototype.navigateIfNeeded=function(){this.storeState.routerReducer&&this.storeState.routerReducer.state&&(this.dispatchTriggeredByRouter||this.router.url!==this.storeState.routerReducer.state.url&&(this.navigationTriggeredByDispatch=!0,this.router.navigateByUrl(this.storeState.routerReducer.state.url)))},t.prototype.setUpStateRollbackEvents=function(){var t=this;this.router.events.subscribe(function(e){e instanceof r.RoutesRecognized?t.lastRoutesRecognized=e:e instanceof r.NavigationCancel?t.dispatchRouterCancel(e):e instanceof r.NavigationError&&t.dispatchRouterError(e)})},t.prototype.dispatchRouterNavigation=function(){this.dispatchRouterAction(u,{routerState:this.routerState,event:new r.RoutesRecognized(this.lastRoutesRecognized.id,this.lastRoutesRecognized.url,this.lastRoutesRecognized.urlAfterRedirects,this.routerState)})},t.prototype.dispatchRouterCancel=function(t){this.dispatchRouterAction(c,{routerState:this.routerState,storeState:this.storeState,event:t})},t.prototype.dispatchRouterError=function(t){this.dispatchRouterAction(p,{routerState:this.routerState,storeState:this.storeState,event:t})},t.prototype.dispatchRouterAction=function(t,e){this.dispatchTriggeredByRouter=!0;try{this.store.dispatch({type:t,payload:e})}finally{this.dispatchTriggeredByRouter=!1,this.navigationTriggeredByDispatch=!1}},t}();h.decorators=[{type:e.NgModule,args:[{providers:[{provide:a,useClass:n}]}]}],h.ctorParameters=function(){return[{type:o.Store},{type:r.Router},{type:a}]},t.ROUTER_ERROR=p,t.ROUTER_CANCEL=c,t.ROUTER_NAVIGATION=u,t.routerReducer=s,t.StoreRouterConnectingModule=h,t.RouterStateSerializer=a,t.DefaultRouterStateSerializer=n,Object.defineProperty(t,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=./dist/router-store/bundles/router-store.umd.min.js.map |
{ | ||
"name": "@ngrx/router-store", | ||
"version": "4.0.3", | ||
"version": "4.0.4", | ||
"description": "Bindings to connect @angular/router to @ngrx/store", | ||
@@ -5,0 +5,0 @@ "module": "@ngrx/router-store.es5.js", |
@@ -18,3 +18,3 @@ import { NavigationCancel, NavigationError, Router, RouterStateSnapshot, RoutesRecognized } from '@angular/router'; | ||
*/ | ||
export declare type RouterNavigationAction<T> = { | ||
export declare type RouterNavigationAction<T = RouterStateSnapshot> = { | ||
type: typeof ROUTER_NAVIGATION; | ||
@@ -30,4 +30,4 @@ payload: RouterNavigationPayload<T>; | ||
*/ | ||
export declare type RouterCancelPayload<T> = { | ||
routerState: RouterStateSnapshot; | ||
export declare type RouterCancelPayload<T, V> = { | ||
routerState: V; | ||
storeState: T; | ||
@@ -39,5 +39,5 @@ event: NavigationCancel; | ||
*/ | ||
export declare type RouterCancelAction<T> = { | ||
export declare type RouterCancelAction<T, V = RouterStateSnapshot> = { | ||
type: typeof ROUTER_CANCEL; | ||
payload: RouterCancelPayload<T>; | ||
payload: RouterCancelPayload<T, V>; | ||
}; | ||
@@ -51,4 +51,4 @@ /** | ||
*/ | ||
export declare type RouterErrorPayload<T> = { | ||
routerState: RouterStateSnapshot; | ||
export declare type RouterErrorPayload<T, V> = { | ||
routerState: V; | ||
storeState: T; | ||
@@ -60,5 +60,5 @@ event: NavigationError; | ||
*/ | ||
export declare type RouterErrorAction<T> = { | ||
export declare type RouterErrorAction<T, V = RouterStateSnapshot> = { | ||
type: typeof ROUTER_ERROR; | ||
payload: RouterErrorPayload<T>; | ||
payload: RouterErrorPayload<T, V>; | ||
}; | ||
@@ -68,8 +68,8 @@ /** | ||
*/ | ||
export declare type RouterAction<T> = RouterNavigationAction<T> | RouterCancelAction<T> | RouterErrorAction<T>; | ||
export declare type RouterReducerState = { | ||
state: RouterStateSnapshot; | ||
export declare type RouterAction<T, V = RouterStateSnapshot> = RouterNavigationAction<T> | RouterCancelAction<T, V> | RouterErrorAction<T, V>; | ||
export declare type RouterReducerState<T = RouterStateSnapshot> = { | ||
state: T; | ||
navigationId: number; | ||
}; | ||
export declare function routerReducer(state: RouterReducerState, action: RouterAction<any>): RouterReducerState; | ||
export declare function routerReducer<T = RouterStateSnapshot>(state: RouterReducerState<T>, action: RouterAction<any>): RouterReducerState<T>; | ||
/** | ||
@@ -76,0 +76,0 @@ * Connects RouterModule with StoreModule. |
@@ -19,2 +19,3 @@ import { NgModule } from '@angular/core'; | ||
/** | ||
* @template T | ||
* @param {?} state | ||
@@ -160,8 +161,3 @@ * @param {?} action | ||
routerState: this.routerState, | ||
event: /** @type {?} */ ({ | ||
id: this.lastRoutesRecognized.id, | ||
url: this.lastRoutesRecognized.url, | ||
urlAfterRedirects: this.lastRoutesRecognized.urlAfterRedirects, | ||
state: this.serializer.serialize(this.routerState), | ||
}), | ||
event: new RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerState), | ||
}); | ||
@@ -168,0 +164,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
96817
1168