@ngrx/router-store
Advanced tools
Comparing version 4.0.4 to 4.1.0
import { NgModule } from '@angular/core'; | ||
import { NavigationCancel, NavigationError, Router, RoutesRecognized } from '@angular/router'; | ||
import { Store } from '@ngrx/store'; | ||
import { of } from 'rxjs/observable/of'; | ||
import { of as of$1 } from 'rxjs/observable/of'; | ||
/** | ||
@@ -110,5 +110,5 @@ * @abstract | ||
*/ | ||
function StoreRouterConnectingModule(store, router, serializer) { | ||
this.store = store; | ||
this.router = router; | ||
function StoreRouterConnectingModule(store$$1, router$$1, serializer) { | ||
this.store = store$$1; | ||
this.router = router$$1; | ||
this.serializer = serializer; | ||
@@ -130,3 +130,3 @@ this.dispatchTriggeredByRouter = false; | ||
_this.dispatchRouterNavigation(); | ||
return of(true); | ||
return of$1(true); | ||
}; | ||
@@ -141,2 +141,4 @@ }; | ||
_this.storeState = s; | ||
}); | ||
this.store.select('routerReducer').subscribe(function () { | ||
_this.navigateIfNeeded(); | ||
@@ -213,3 +215,3 @@ }); | ||
storeState: this.storeState, | ||
event: event, | ||
event: new NavigationError(event.id, event.url, "" + event), | ||
}); | ||
@@ -216,0 +218,0 @@ }; |
import { NgModule } from '@angular/core'; | ||
import { NavigationCancel, NavigationError, Router, RoutesRecognized } from '@angular/router'; | ||
import { Store } from '@ngrx/store'; | ||
import { of } from 'rxjs/observable/of'; | ||
import { of as of$1 } from 'rxjs/observable/of'; | ||
@@ -106,5 +106,5 @@ /** | ||
*/ | ||
constructor(store, router, serializer) { | ||
this.store = store; | ||
this.router = router; | ||
constructor(store$$1, router$$1, serializer) { | ||
this.store = store$$1; | ||
this.router = router$$1; | ||
this.serializer = serializer; | ||
@@ -125,3 +125,3 @@ this.dispatchTriggeredByRouter = false; | ||
this.dispatchRouterNavigation(); | ||
return of(true); | ||
return of$1(true); | ||
}; | ||
@@ -135,2 +135,4 @@ } | ||
this.storeState = s; | ||
}); | ||
this.store.select('routerReducer').subscribe(() => { | ||
this.navigateIfNeeded(); | ||
@@ -206,3 +208,3 @@ }); | ||
storeState: this.storeState, | ||
event, | ||
event: new NavigationError(event.id, event.url, `${event}`), | ||
}); | ||
@@ -209,0 +211,0 @@ } |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/router'), require('@ngrx/store'), require('rxjs/observable/of')) : | ||
typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/router', '@ngrx/store', 'rxjs/observable/of'], factory) : | ||
(factory((global.ngrx = global.ngrx || {}, global.ngrx.routerStore = global.ngrx.routerStore || {}),global.ng.core,global.ng.router,global.ngrx.store,global.Rx.Observable)); | ||
}(this, (function (exports,_angular_core,_angular_router,_ngrx_store,rxjs_observable_of) { 'use strict'; | ||
(factory((global.ngrx = global.ngrx || {}, global.ngrx.routerStore = {}),global.ng.core,global.ng.router,global.ngrx.store,global.Rx.Observable)); | ||
}(this, (function (exports,core,router,store,of) { 'use strict'; | ||
@@ -112,5 +112,5 @@ /** | ||
*/ | ||
function StoreRouterConnectingModule(store, router, serializer) { | ||
this.store = store; | ||
this.router = router; | ||
function StoreRouterConnectingModule(store$$1, router$$1, serializer) { | ||
this.store = store$$1; | ||
this.router = router$$1; | ||
this.serializer = serializer; | ||
@@ -132,3 +132,3 @@ this.dispatchTriggeredByRouter = false; | ||
_this.dispatchRouterNavigation(); | ||
return rxjs_observable_of.of(true); | ||
return of.of(true); | ||
}; | ||
@@ -143,2 +143,4 @@ }; | ||
_this.storeState = s; | ||
}); | ||
this.store.select('routerReducer').subscribe(function () { | ||
_this.navigateIfNeeded(); | ||
@@ -176,9 +178,9 @@ }); | ||
this.router.events.subscribe(function (e) { | ||
if (e instanceof _angular_router.RoutesRecognized) { | ||
if (e instanceof router.RoutesRecognized) { | ||
_this.lastRoutesRecognized = e; | ||
} | ||
else if (e instanceof _angular_router.NavigationCancel) { | ||
else if (e instanceof router.NavigationCancel) { | ||
_this.dispatchRouterCancel(e); | ||
} | ||
else if (e instanceof _angular_router.NavigationError) { | ||
else if (e instanceof router.NavigationError) { | ||
_this.dispatchRouterError(e); | ||
@@ -194,3 +196,3 @@ } | ||
routerState: this.routerState, | ||
event: new _angular_router.RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerState), | ||
event: new router.RoutesRecognized(this.lastRoutesRecognized.id, this.lastRoutesRecognized.url, this.lastRoutesRecognized.urlAfterRedirects, this.routerState), | ||
}); | ||
@@ -217,3 +219,3 @@ }; | ||
storeState: this.storeState, | ||
event: event, | ||
event: new router.NavigationError(event.id, event.url, "" + event), | ||
}); | ||
@@ -239,3 +241,3 @@ }; | ||
StoreRouterConnectingModule.decorators = [ | ||
{ type: _angular_core.NgModule, args: [{ | ||
{ type: core.NgModule, args: [{ | ||
providers: [ | ||
@@ -250,4 +252,4 @@ { provide: RouterStateSerializer, useClass: DefaultRouterStateSerializer }, | ||
StoreRouterConnectingModule.ctorParameters = function () { return [ | ||
{ type: _ngrx_store.Store, }, | ||
{ type: _angular_router.Router, }, | ||
{ type: store.Store, }, | ||
{ type: router.Router, }, | ||
{ type: RouterStateSerializer, }, | ||
@@ -254,0 +256,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 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})}); | ||
!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.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}),this.store.select("routerReducer").subscribe(function(){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(h,{routerState:this.routerState,storeState:this.storeState,event:new r.NavigationError(t.id,t.url,""+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})}); | ||
//# sourceMappingURL=./dist/router-store/bundles/router-store.umd.min.js.map |
{ | ||
"name": "@ngrx/router-store", | ||
"version": "4.0.4", | ||
"version": "4.1.0", | ||
"description": "Bindings to connect @angular/router to @ngrx/store", | ||
@@ -5,0 +5,0 @@ "module": "@ngrx/router-store.es5.js", |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":3,"metadata":{"ROUTER_ERROR":"ROUTE_ERROR","ROUTER_CANCEL":"ROUTER_CANCEL","ROUTER_NAVIGATION":"ROUTER_NAVIGATION","routerReducer":{"__symbolic":"function"},"StoreRouterConnectingModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"providers":[{"provide":{"__symbolic":"reference","name":"RouterStateSerializer"},"useClass":{"__symbolic":"reference","name":"DefaultRouterStateSerializer"}}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Store","module":"@ngrx/store","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/router","name":"Router"},{"__symbolic":"reference","name":"RouterStateSerializer"}]}],"setUpBeforePreactivationHook":[{"__symbolic":"method"}],"setUpStoreStateListener":[{"__symbolic":"method"}],"shouldDispatchRouterNavigation":[{"__symbolic":"method"}],"navigateIfNeeded":[{"__symbolic":"method"}],"setUpStateRollbackEvents":[{"__symbolic":"method"}],"dispatchRouterNavigation":[{"__symbolic":"method"}],"dispatchRouterCancel":[{"__symbolic":"method"}],"dispatchRouterError":[{"__symbolic":"method"}],"dispatchRouterAction":[{"__symbolic":"method"}]}},"RouterStateSerializer":{"__symbolic":"class","arity":1,"members":{"serialize":[{"__symbolic":"method"}]}},"DefaultRouterStateSerializer":{"__symbolic":"class","members":{"serialize":[{"__symbolic":"method"}]}}},"origins":{"ROUTER_ERROR":"./src/router_store_module","ROUTER_CANCEL":"./src/router_store_module","ROUTER_NAVIGATION":"./src/router_store_module","RouterNavigationAction":"./src/router_store_module","RouterCancelAction":"./src/router_store_module","RouterErrorAction":"./src/router_store_module","RouterAction":"./src/router_store_module","routerReducer":"./src/router_store_module","RouterErrorPayload":"./src/router_store_module","RouterReducerState":"./src/router_store_module","RouterCancelPayload":"./src/router_store_module","RouterNavigationPayload":"./src/router_store_module","StoreRouterConnectingModule":"./src/router_store_module","RouterStateSerializer":"./src/serializer","DefaultRouterStateSerializer":"./src/serializer"},"importAs":"@ngrx/router-store"} | ||
{"__symbolic":"module","version":3,"metadata":{"ROUTER_ERROR":"ROUTE_ERROR","ROUTER_CANCEL":"ROUTER_CANCEL","ROUTER_NAVIGATION":"ROUTER_NAVIGATION","RouterNavigationAction":{"__symbolic":"interface"},"RouterCancelAction":{"__symbolic":"interface"},"RouterErrorAction":{"__symbolic":"interface"},"RouterAction":{"__symbolic":"interface"},"routerReducer":{"__symbolic":"function"},"RouterErrorPayload":{"__symbolic":"interface"},"RouterReducerState":{"__symbolic":"interface"},"RouterCancelPayload":{"__symbolic":"interface"},"RouterNavigationPayload":{"__symbolic":"interface"},"StoreRouterConnectingModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"providers":[{"provide":{"__symbolic":"reference","name":"RouterStateSerializer"},"useClass":{"__symbolic":"reference","name":"DefaultRouterStateSerializer"}}]}]}],"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","name":"Store","module":"@ngrx/store","arguments":[{"__symbolic":"reference","name":"any"}]},{"__symbolic":"reference","module":"@angular/router","name":"Router"},{"__symbolic":"reference","name":"RouterStateSerializer"}]}],"setUpBeforePreactivationHook":[{"__symbolic":"method"}],"setUpStoreStateListener":[{"__symbolic":"method"}],"shouldDispatchRouterNavigation":[{"__symbolic":"method"}],"navigateIfNeeded":[{"__symbolic":"method"}],"setUpStateRollbackEvents":[{"__symbolic":"method"}],"dispatchRouterNavigation":[{"__symbolic":"method"}],"dispatchRouterCancel":[{"__symbolic":"method"}],"dispatchRouterError":[{"__symbolic":"method"}],"dispatchRouterAction":[{"__symbolic":"method"}]}},"RouterStateSerializer":{"__symbolic":"class","arity":1,"members":{"serialize":[{"__symbolic":"method"}]}},"DefaultRouterStateSerializer":{"__symbolic":"class","members":{"serialize":[{"__symbolic":"method"}]}}},"origins":{"ROUTER_ERROR":"./src/router_store_module","ROUTER_CANCEL":"./src/router_store_module","ROUTER_NAVIGATION":"./src/router_store_module","RouterNavigationAction":"./src/router_store_module","RouterCancelAction":"./src/router_store_module","RouterErrorAction":"./src/router_store_module","RouterAction":"./src/router_store_module","routerReducer":"./src/router_store_module","RouterErrorPayload":"./src/router_store_module","RouterReducerState":"./src/router_store_module","RouterCancelPayload":"./src/router_store_module","RouterNavigationPayload":"./src/router_store_module","StoreRouterConnectingModule":"./src/router_store_module","RouterStateSerializer":"./src/serializer","DefaultRouterStateSerializer":"./src/serializer"},"importAs":"@ngrx/router-store"} |
@@ -112,2 +112,4 @@ import { NgModule } from '@angular/core'; | ||
this.storeState = s; | ||
}); | ||
this.store.select('routerReducer').subscribe(() => { | ||
this.navigateIfNeeded(); | ||
@@ -183,3 +185,3 @@ }); | ||
storeState: this.storeState, | ||
event, | ||
event: new NavigationError(event.id, event.url, `${event}`), | ||
}); | ||
@@ -186,0 +188,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
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
98418
1176