@ngrx/store-devtools
Advanced tools
Comparing version 3.2.2 to 3.2.3
@@ -1,1 +0,1 @@ | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@ngrx/store"),require("rxjs/ReplaySubject"),require("rxjs/operator/map"),require("rxjs/operator/merge"),require("rxjs/operator/observeOn"),require("rxjs/operator/scan"),require("rxjs/operator/skip"),require("rxjs/operator/withLatestFrom"),require("rxjs/scheduler/queue"),require("rxjs/Observable"),require("rxjs/observable/empty"),require("rxjs/operator/filter"),require("rxjs/operator/share"),require("rxjs/operator/switchMap"),require("rxjs/operator/takeUntil")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@ngrx/store","rxjs/ReplaySubject","rxjs/operator/map","rxjs/operator/merge","rxjs/operator/observeOn","rxjs/operator/scan","rxjs/operator/skip","rxjs/operator/withLatestFrom","rxjs/scheduler/queue","rxjs/Observable","rxjs/observable/empty","rxjs/operator/filter","rxjs/operator/share","rxjs/operator/switchMap","rxjs/operator/takeUntil"],factory):factory((global.ngrx=global.ngrx||{},global.ngrx.storeDevtools=global.ngrx.storeDevtools||{}),global.ng.core,global.ngrx.store,global.Rx,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Scheduler,global.Rx,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype)}(this,function(exports,_angular_core,_ngrx_store,rxjs_ReplaySubject,rxjs_operator_map,rxjs_operator_merge,rxjs_operator_observeOn,rxjs_operator_scan,rxjs_operator_skip,rxjs_operator_withLatestFrom,rxjs_scheduler_queue,rxjs_Observable,rxjs_observable_empty,rxjs_operator_filter,rxjs_operator_share,rxjs_operator_switchMap,rxjs_operator_takeUntil){"use strict";function difference(first,second){return first.filter(function(item){return second.indexOf(item)<0})}function unliftState(liftedState){var computedStates=liftedState.computedStates,currentStateIndex=liftedState.currentStateIndex,state=computedStates[currentStateIndex].state;return state}function liftAction(action){return StoreDevtoolActions.performAction(action)}function applyOperators(input$,operators){return operators.reduce(function(source$,_a){var operator=_a[0],args=_a.slice(1);return operator.apply(source$,args)},input$)}function computeNextEntry(reducer,action,state,error){if(error)return{state:state,error:"Interrupted by an error up the chain"};var nextError,nextState=state;try{nextState=reducer(state,action)}catch(err){nextError=err.toString(),console.error(err.stack||err)}return{state:nextState,error:nextError}}function recomputeStates(computedStates,minInvalidatedStateIndex,reducer,committedState,actionsById,stagedActionIds,skippedActionIds){if(minInvalidatedStateIndex>=computedStates.length&&computedStates.length===stagedActionIds.length)return computedStates;for(var nextComputedStates=computedStates.slice(0,minInvalidatedStateIndex),i=minInvalidatedStateIndex;i<stagedActionIds.length;i++){var actionId=stagedActionIds[i],action=actionsById[actionId].action,previousEntry=nextComputedStates[i-1],previousState=previousEntry?previousEntry.state:committedState,previousError=previousEntry?previousEntry.error:void 0,shouldSkip=skippedActionIds.indexOf(actionId)>-1,entry=shouldSkip?previousEntry:computeNextEntry(reducer,action,previousState,previousError);nextComputedStates.push(entry)}return nextComputedStates}function liftInitialState(initialCommittedState,monitorReducer){return{monitorState:monitorReducer(void 0,{}),nextActionId:1,actionsById:{0:liftAction(INIT_ACTION)},stagedActionIds:[0],skippedActionIds:[],committedState:initialCommittedState,currentStateIndex:0,computedStates:[]}}function liftReducerWith(initialCommittedState,initialLiftedState,monitorReducer,options){return void 0===options&&(options={}),function(reducer){return function(liftedState,liftedAction){function commitExcessActions(n){for(var excess=n,idsToDelete=stagedActionIds.slice(1,excess+1),i=0;i<idsToDelete.length;i++){if(computedStates[i+1].error){excess=i,idsToDelete=stagedActionIds.slice(1,excess+1);break}delete actionsById[idsToDelete[i]]}skippedActionIds=skippedActionIds.filter(function(id){return-1===idsToDelete.indexOf(id)}),stagedActionIds=[0].concat(stagedActionIds.slice(excess+1)),committedState=computedStates[excess].state,computedStates=computedStates.slice(excess),currentStateIndex=currentStateIndex>excess?currentStateIndex-excess:0}var _a=liftedState||initialLiftedState,monitorState=_a.monitorState,actionsById=_a.actionsById,nextActionId=_a.nextActionId,stagedActionIds=_a.stagedActionIds,skippedActionIds=_a.skippedActionIds,committedState=_a.committedState,currentStateIndex=_a.currentStateIndex,computedStates=_a.computedStates;liftedState||(actionsById=Object.create(actionsById));var minInvalidatedStateIndex=0;switch(liftedAction.type){case ActionTypes.RESET:actionsById={0:liftAction(INIT_ACTION)},nextActionId=1,stagedActionIds=[0],skippedActionIds=[],committedState=initialCommittedState,currentStateIndex=0,computedStates=[];break;case ActionTypes.COMMIT:actionsById={0:liftAction(INIT_ACTION)},nextActionId=1,stagedActionIds=[0],skippedActionIds=[],committedState=computedStates[currentStateIndex].state,currentStateIndex=0,computedStates=[];break;case ActionTypes.ROLLBACK:actionsById={0:liftAction(INIT_ACTION)},nextActionId=1,stagedActionIds=[0],skippedActionIds=[],currentStateIndex=0,computedStates=[];break;case ActionTypes.TOGGLE_ACTION:var actionId_1=liftedAction.id,index=skippedActionIds.indexOf(actionId_1);skippedActionIds=-1===index?[actionId_1].concat(skippedActionIds):skippedActionIds.filter(function(id){return id!==actionId_1}),minInvalidatedStateIndex=stagedActionIds.indexOf(actionId_1);break;case ActionTypes.SET_ACTIONS_ACTIVE:for(var start=liftedAction.start,end=liftedAction.end,active=liftedAction.active,actionIds=[],i=start;end>i;i++)actionIds.push(i);skippedActionIds=active?difference(skippedActionIds,actionIds):skippedActionIds.concat(actionIds),minInvalidatedStateIndex=stagedActionIds.indexOf(start);break;case ActionTypes.JUMP_TO_STATE:currentStateIndex=liftedAction.index,minInvalidatedStateIndex=1/0;break;case ActionTypes.SWEEP:stagedActionIds=difference(stagedActionIds,skippedActionIds),skippedActionIds=[],currentStateIndex=Math.min(currentStateIndex,stagedActionIds.length-1);break;case ActionTypes.PERFORM_ACTION:options.maxAge&&stagedActionIds.length===options.maxAge&&commitExcessActions(1),currentStateIndex===stagedActionIds.length-1&¤tStateIndex++;var actionId=nextActionId++;actionsById[actionId]=liftedAction,stagedActionIds=stagedActionIds.concat([actionId]),minInvalidatedStateIndex=stagedActionIds.length-1;break;case ActionTypes.IMPORT_STATE:_b=liftedAction.nextLiftedState,monitorState=_b.monitorState,actionsById=_b.actionsById,nextActionId=_b.nextActionId,stagedActionIds=_b.stagedActionIds,skippedActionIds=_b.skippedActionIds,committedState=_b.committedState,currentStateIndex=_b.currentStateIndex,computedStates=_b.computedStates,_b;break;case _ngrx_store.Reducer.REPLACE:case _ngrx_store.Dispatcher.INIT:minInvalidatedStateIndex=0,options.maxAge&&stagedActionIds.length>options.maxAge&&(computedStates=recomputeStates(computedStates,minInvalidatedStateIndex,reducer,committedState,actionsById,stagedActionIds,skippedActionIds),commitExcessActions(stagedActionIds.length-options.maxAge),minInvalidatedStateIndex=1/0);break;default:minInvalidatedStateIndex=1/0}return computedStates=recomputeStates(computedStates,minInvalidatedStateIndex,reducer,committedState,actionsById,stagedActionIds,skippedActionIds),monitorState=monitorReducer(monitorState,liftedAction),{monitorState:monitorState,actionsById:actionsById,nextActionId:nextActionId,stagedActionIds:stagedActionIds,skippedActionIds:skippedActionIds,committedState:committedState,currentStateIndex:currentStateIndex,computedStates:computedStates};var _b}}}function _createReduxDevtoolsExtension(){var legacyExtensionKey="devToolsExtension",extensionKey="__REDUX_DEVTOOLS_EXTENSION__";return"object"==typeof window&&"undefined"!=typeof window[legacyExtensionKey]?window[legacyExtensionKey]:"object"==typeof window&&"undefined"!=typeof window[extensionKey]?window[extensionKey]:null}function _createState(devtools){return devtools.state}function _createReducer(dispatcher,reducer){return new _ngrx_store.Reducer(dispatcher,reducer)}function _createStateIfExtension(extension,injector){if(extension){var devtools=injector.get(StoreDevtools);return _createState(devtools)}var initialState=injector.get(_ngrx_store.INITIAL_STATE),dispatcher=injector.get(_ngrx_store.Dispatcher),reducer=injector.get(_ngrx_store.Reducer);return new _ngrx_store.State(initialState,dispatcher,reducer)}function _createReducerIfExtension(extension,injector){if(extension){var devtoolsDispatcher=injector.get(DevtoolsDispatcher),reducer=injector.get(_ngrx_store.INITIAL_REDUCER);return _createReducer(devtoolsDispatcher,reducer)}var dispatcher=injector.get(_ngrx_store.Dispatcher),reducer=injector.get(_ngrx_store.INITIAL_REDUCER);return new _ngrx_store.Reducer(dispatcher,reducer)}function _createExtensionOptions(){return{maxAge:1/0,monitor:function(){return null}}}var ActionTypes={PERFORM_ACTION:"PERFORM_ACTION",RESET:"RESET",ROLLBACK:"ROLLBACK",COMMIT:"COMMIT",SWEEP:"SWEEP",TOGGLE_ACTION:"TOGGLE_ACTION",SET_ACTIONS_ACTIVE:"SET_ACTIONS_ACTIVE",JUMP_TO_STATE:"JUMP_TO_STATE",IMPORT_STATE:"IMPORT_STATE"},StoreDevtoolActions={performAction:function(action){if("undefined"==typeof action.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');return{type:ActionTypes.PERFORM_ACTION,action:action,timestamp:Date.now()}},reset:function(){return{type:ActionTypes.RESET,timestamp:Date.now()}},rollback:function(){return{type:ActionTypes.ROLLBACK,timestamp:Date.now()}},commit:function(){return{type:ActionTypes.COMMIT,timestamp:Date.now()}},sweep:function(){return{type:ActionTypes.SWEEP}},toggleAction:function(id){return{type:ActionTypes.TOGGLE_ACTION,id:id}},setActionsActive:function(start,end,active){return void 0===active&&(active=!0),{type:ActionTypes.SET_ACTIONS_ACTIVE,start:start,end:end,active:active}},jumpToState:function(index){return{type:ActionTypes.JUMP_TO_STATE,index:index}},importState:function(nextLiftedState){return{type:ActionTypes.IMPORT_STATE,nextLiftedState:nextLiftedState}}},ExtensionActionTypes={START:"START",DISPATCH:"DISPATCH",STOP:"STOP",ACTION:"ACTION"},REDUX_DEVTOOLS_EXTENSION=new _angular_core.OpaqueToken("Redux Devtools Extension"),DevtoolsExtension=function(){function DevtoolsExtension(devtoolsExtension){this.instanceId="ngrx-store-"+Date.now(),this.devtoolsExtension=devtoolsExtension,this.createActionStreams()}return DevtoolsExtension.prototype.notify=function(action,state){this.devtoolsExtension&&this.devtoolsExtension.send(null,state,!1,this.instanceId)},DevtoolsExtension.prototype.createChangesObservable=function(){var _this=this;return this.devtoolsExtension?new rxjs_Observable.Observable(function(subscriber){var connection=_this.devtoolsExtension.connect({instanceId:_this.instanceId});return connection.subscribe(function(change){return subscriber.next(change)}),connection.unsubscribe}):rxjs_observable_empty.empty()},DevtoolsExtension.prototype.createActionStreams=function(){var _this=this,changes$=rxjs_operator_share.share.call(this.createChangesObservable()),start$=rxjs_operator_filter.filter.call(changes$,function(change){return change.type===ExtensionActionTypes.START}),stop$=rxjs_operator_filter.filter.call(changes$,function(change){return change.type===ExtensionActionTypes.STOP}),liftedActions$=applyOperators(changes$,[[rxjs_operator_filter.filter,function(change){return change.type===ExtensionActionTypes.DISPATCH}],[rxjs_operator_map.map,function(change){return _this.unwrapAction(change.payload)}]]),actions$=applyOperators(changes$,[[rxjs_operator_filter.filter,function(change){return change.type===ExtensionActionTypes.ACTION}],[rxjs_operator_map.map,function(change){return _this.unwrapAction(change.payload)}]]),actionsUntilStop$=rxjs_operator_takeUntil.takeUntil.call(actions$,stop$),liftedUntilStop$=rxjs_operator_takeUntil.takeUntil.call(liftedActions$,stop$);this.actions$=rxjs_operator_switchMap.switchMap.call(start$,function(){return actionsUntilStop$}),this.liftedActions$=rxjs_operator_switchMap.switchMap.call(start$,function(){return liftedUntilStop$})},DevtoolsExtension.prototype.unwrapAction=function(action){return"string"==typeof action?eval("("+action+")"):action},DevtoolsExtension.decorators=[{type:_angular_core.Injectable}],DevtoolsExtension.ctorParameters=[{type:void 0,decorators:[{type:_angular_core.Inject,args:[REDUX_DEVTOOLS_EXTENSION]}]}],DevtoolsExtension}(),INIT_ACTION={type:_ngrx_store.Dispatcher.INIT},STORE_DEVTOOLS_CONFIG=new _angular_core.OpaqueToken("@ngrx/devtools Options"),__extends=void 0||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},DevtoolsDispatcher=function(_super){function DevtoolsDispatcher(){_super.apply(this,arguments)}return __extends(DevtoolsDispatcher,_super),DevtoolsDispatcher.decorators=[{type:_angular_core.Injectable}],DevtoolsDispatcher.ctorParameters=[],DevtoolsDispatcher}(_ngrx_store.Dispatcher),StoreDevtools=function(){function StoreDevtools(dispatcher,actions$,reducers$,extension,initialState,config){var liftedInitialState=liftInitialState(initialState,config.monitor),liftReducer=liftReducerWith(initialState,liftedInitialState,config.monitor,{maxAge:config.maxAge}),liftedAction$=applyOperators(actions$,[[rxjs_operator_skip.skip,1],[rxjs_operator_merge.merge,extension.actions$],[rxjs_operator_map.map,liftAction],[rxjs_operator_merge.merge,dispatcher,extension.liftedActions$],[rxjs_operator_observeOn.observeOn,rxjs_scheduler_queue.queue]]),liftedReducer$=rxjs_operator_map.map.call(reducers$,liftReducer),liftedStateSubject=new rxjs_ReplaySubject.ReplaySubject(1),liftedStateSubscription=applyOperators(liftedAction$,[[rxjs_operator_withLatestFrom.withLatestFrom,liftedReducer$],[rxjs_operator_scan.scan,function(liftedState,_a){var action=_a[0],reducer=_a[1],nextState=reducer(liftedState,action);return extension.notify(action,nextState),nextState},liftedInitialState]]).subscribe(liftedStateSubject),liftedState$=liftedStateSubject.asObservable(),state$=rxjs_operator_map.map.call(liftedState$,unliftState);this.stateSubscription=liftedStateSubscription,this.dispatcher=dispatcher,this.liftedState=liftedState$,this.state=state$}return StoreDevtools.prototype.dispatch=function(action){this.dispatcher.dispatch(action)},StoreDevtools.prototype.next=function(action){this.dispatcher.dispatch(action)},StoreDevtools.prototype.error=function(){},StoreDevtools.prototype.complete=function(){},StoreDevtools.prototype.performAction=function(action){this.dispatch(StoreDevtoolActions.performAction(action))},StoreDevtools.prototype.reset=function(){this.dispatch(StoreDevtoolActions.reset())},StoreDevtools.prototype.rollback=function(){this.dispatch(StoreDevtoolActions.rollback())},StoreDevtools.prototype.commit=function(){this.dispatch(StoreDevtoolActions.commit())},StoreDevtools.prototype.sweep=function(){this.dispatch(StoreDevtoolActions.sweep())},StoreDevtools.prototype.toggleAction=function(id){this.dispatch(StoreDevtoolActions.toggleAction(id))},StoreDevtools.prototype.jumpToState=function(index){this.dispatch(StoreDevtoolActions.jumpToState(index))},StoreDevtools.prototype.importState=function(nextLiftedState){this.dispatch(StoreDevtoolActions.importState(nextLiftedState))},StoreDevtools.decorators=[{type:_angular_core.Injectable}],StoreDevtools.ctorParameters=[{type:DevtoolsDispatcher},{type:_ngrx_store.Dispatcher},{type:_ngrx_store.Reducer},{type:DevtoolsExtension},{type:void 0,decorators:[{type:_angular_core.Inject,args:[_ngrx_store.INITIAL_STATE]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STORE_DEVTOOLS_CONFIG]}]}],StoreDevtools}(),StoreDevtoolsModule=function(){function StoreDevtoolsModule(){}return StoreDevtoolsModule.instrumentStore=function(_options){void 0===_options&&(_options={});var DEFAULT_OPTIONS={monitor:function(){return null}},options=Object.assign({},DEFAULT_OPTIONS,_options);if(options.maxAge&&options.maxAge<2)throw new Error("Devtools 'maxAge' cannot be less than 2, got "+options.maxAge);return{ngModule:StoreDevtoolsModule,providers:[{provide:_ngrx_store.State,deps:[StoreDevtools],useFactory:_createState},{provide:_ngrx_store.Reducer,deps:[DevtoolsDispatcher,_ngrx_store.INITIAL_REDUCER],useFactory:_createReducer},{provide:STORE_DEVTOOLS_CONFIG,useValue:options}]}},StoreDevtoolsModule.instrumentOnlyWithExtension=function(){return{ngModule:StoreDevtoolsModule,providers:[{provide:_ngrx_store.State,deps:[REDUX_DEVTOOLS_EXTENSION,_angular_core.Injector],useFactory:_createStateIfExtension},{provide:_ngrx_store.Reducer,deps:[REDUX_DEVTOOLS_EXTENSION,_angular_core.Injector],useFactory:_createReducerIfExtension},{provide:STORE_DEVTOOLS_CONFIG,useFactory:_createExtensionOptions}]}},StoreDevtoolsModule.decorators=[{type:_angular_core.NgModule,args:[{imports:[_ngrx_store.StoreModule],providers:[DevtoolsExtension,DevtoolsDispatcher,StoreDevtools,{provide:REDUX_DEVTOOLS_EXTENSION,useFactory:_createReduxDevtoolsExtension}]}]}],StoreDevtoolsModule.ctorParameters=[],StoreDevtoolsModule}();exports.StoreDevtoolsModule=StoreDevtoolsModule,exports.StoreDevtools=StoreDevtools,Object.defineProperty(exports,"__esModule",{value:!0})}); | ||
!function(global,factory){"object"==typeof exports&&"undefined"!=typeof module?factory(exports,require("@angular/core"),require("@ngrx/store"),require("rxjs/ReplaySubject"),require("rxjs/operator/map"),require("rxjs/operator/merge"),require("rxjs/operator/observeOn"),require("rxjs/operator/scan"),require("rxjs/operator/skip"),require("rxjs/operator/withLatestFrom"),require("rxjs/scheduler/queue"),require("rxjs/Observable"),require("rxjs/observable/empty"),require("rxjs/operator/filter"),require("rxjs/operator/share"),require("rxjs/operator/switchMap"),require("rxjs/operator/takeUntil")):"function"==typeof define&&define.amd?define(["exports","@angular/core","@ngrx/store","rxjs/ReplaySubject","rxjs/operator/map","rxjs/operator/merge","rxjs/operator/observeOn","rxjs/operator/scan","rxjs/operator/skip","rxjs/operator/withLatestFrom","rxjs/scheduler/queue","rxjs/Observable","rxjs/observable/empty","rxjs/operator/filter","rxjs/operator/share","rxjs/operator/switchMap","rxjs/operator/takeUntil"],factory):factory((global.ngrx=global.ngrx||{},global.ngrx.storeDevtools=global.ngrx.storeDevtools||{}),global.ng.core,global.ngrx.store,global.Rx,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Scheduler,global.Rx,global.Rx.Observable,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype,global.Rx.Observable.prototype)}(this,function(exports,_angular_core,_ngrx_store,rxjs_ReplaySubject,rxjs_operator_map,rxjs_operator_merge,rxjs_operator_observeOn,rxjs_operator_scan,rxjs_operator_skip,rxjs_operator_withLatestFrom,rxjs_scheduler_queue,rxjs_Observable,rxjs_observable_empty,rxjs_operator_filter,rxjs_operator_share,rxjs_operator_switchMap,rxjs_operator_takeUntil){"use strict";function difference(first,second){return first.filter(function(item){return second.indexOf(item)<0})}function unliftState(liftedState){var computedStates=liftedState.computedStates,currentStateIndex=liftedState.currentStateIndex,state=computedStates[currentStateIndex].state;return state}function liftAction(action){return StoreDevtoolActions.performAction(action)}function applyOperators(input$,operators){return operators.reduce(function(source$,_a){var operator=_a[0],args=_a.slice(1);return operator.apply(source$,args)},input$)}function computeNextEntry(reducer,action,state,error){if(error)return{state:state,error:"Interrupted by an error up the chain"};var nextError,nextState=state;try{nextState=reducer(state,action)}catch(err){nextError=err.toString(),console.error(err.stack||err)}return{state:nextState,error:nextError}}function recomputeStates(computedStates,minInvalidatedStateIndex,reducer,committedState,actionsById,stagedActionIds,skippedActionIds){if(minInvalidatedStateIndex>=computedStates.length&&computedStates.length===stagedActionIds.length)return computedStates;for(var nextComputedStates=computedStates.slice(0,minInvalidatedStateIndex),i=minInvalidatedStateIndex;i<stagedActionIds.length;i++){var actionId=stagedActionIds[i],action=actionsById[actionId].action,previousEntry=nextComputedStates[i-1],previousState=previousEntry?previousEntry.state:committedState,previousError=previousEntry?previousEntry.error:void 0,shouldSkip=skippedActionIds.indexOf(actionId)>-1,entry=shouldSkip?previousEntry:computeNextEntry(reducer,action,previousState,previousError);nextComputedStates.push(entry)}return nextComputedStates}function liftInitialState(initialCommittedState,monitorReducer){return{monitorState:monitorReducer(void 0,{}),nextActionId:1,actionsById:{0:liftAction(INIT_ACTION)},stagedActionIds:[0],skippedActionIds:[],committedState:initialCommittedState,currentStateIndex:0,computedStates:[]}}function liftReducerWith(initialCommittedState,initialLiftedState,monitorReducer,options){return void 0===options&&(options={}),function(reducer){return function(liftedState,liftedAction){function commitExcessActions(n){for(var excess=n,idsToDelete=stagedActionIds.slice(1,excess+1),i=0;i<idsToDelete.length;i++){if(computedStates[i+1].error){excess=i,idsToDelete=stagedActionIds.slice(1,excess+1);break}delete actionsById[idsToDelete[i]]}skippedActionIds=skippedActionIds.filter(function(id){return-1===idsToDelete.indexOf(id)}),stagedActionIds=[0].concat(stagedActionIds.slice(excess+1)),committedState=computedStates[excess].state,computedStates=computedStates.slice(excess),currentStateIndex=currentStateIndex>excess?currentStateIndex-excess:0}var _a=liftedState||initialLiftedState,monitorState=_a.monitorState,actionsById=_a.actionsById,nextActionId=_a.nextActionId,stagedActionIds=_a.stagedActionIds,skippedActionIds=_a.skippedActionIds,committedState=_a.committedState,currentStateIndex=_a.currentStateIndex,computedStates=_a.computedStates;liftedState||(actionsById=Object.create(actionsById));var minInvalidatedStateIndex=0;switch(liftedAction.type){case ActionTypes.RESET:actionsById={0:liftAction(INIT_ACTION)},nextActionId=1,stagedActionIds=[0],skippedActionIds=[],committedState=initialCommittedState,currentStateIndex=0,computedStates=[];break;case ActionTypes.COMMIT:actionsById={0:liftAction(INIT_ACTION)},nextActionId=1,stagedActionIds=[0],skippedActionIds=[],committedState=computedStates[currentStateIndex].state,currentStateIndex=0,computedStates=[];break;case ActionTypes.ROLLBACK:actionsById={0:liftAction(INIT_ACTION)},nextActionId=1,stagedActionIds=[0],skippedActionIds=[],currentStateIndex=0,computedStates=[];break;case ActionTypes.TOGGLE_ACTION:var actionId_1=liftedAction.id,index=skippedActionIds.indexOf(actionId_1);skippedActionIds=-1===index?[actionId_1].concat(skippedActionIds):skippedActionIds.filter(function(id){return id!==actionId_1}),minInvalidatedStateIndex=stagedActionIds.indexOf(actionId_1);break;case ActionTypes.SET_ACTIONS_ACTIVE:for(var start=liftedAction.start,end=liftedAction.end,active=liftedAction.active,actionIds=[],i=start;end>i;i++)actionIds.push(i);skippedActionIds=active?difference(skippedActionIds,actionIds):skippedActionIds.concat(actionIds),minInvalidatedStateIndex=stagedActionIds.indexOf(start);break;case ActionTypes.JUMP_TO_STATE:currentStateIndex=liftedAction.index,minInvalidatedStateIndex=1/0;break;case ActionTypes.SWEEP:stagedActionIds=difference(stagedActionIds,skippedActionIds),skippedActionIds=[],currentStateIndex=Math.min(currentStateIndex,stagedActionIds.length-1);break;case ActionTypes.PERFORM_ACTION:options.maxAge&&stagedActionIds.length===options.maxAge&&commitExcessActions(1),currentStateIndex===stagedActionIds.length-1&¤tStateIndex++;var actionId=nextActionId++;actionsById[actionId]=liftedAction,stagedActionIds=stagedActionIds.concat([actionId]),minInvalidatedStateIndex=stagedActionIds.length-1;break;case ActionTypes.IMPORT_STATE:_b=liftedAction.nextLiftedState,monitorState=_b.monitorState,actionsById=_b.actionsById,nextActionId=_b.nextActionId,stagedActionIds=_b.stagedActionIds,skippedActionIds=_b.skippedActionIds,committedState=_b.committedState,currentStateIndex=_b.currentStateIndex,computedStates=_b.computedStates,_b;break;case _ngrx_store.Reducer.REPLACE:case _ngrx_store.Dispatcher.INIT:minInvalidatedStateIndex=0,options.maxAge&&stagedActionIds.length>options.maxAge&&(computedStates=recomputeStates(computedStates,minInvalidatedStateIndex,reducer,committedState,actionsById,stagedActionIds,skippedActionIds),commitExcessActions(stagedActionIds.length-options.maxAge),minInvalidatedStateIndex=1/0);break;default:minInvalidatedStateIndex=1/0}return computedStates=recomputeStates(computedStates,minInvalidatedStateIndex,reducer,committedState,actionsById,stagedActionIds,skippedActionIds),monitorState=monitorReducer(monitorState,liftedAction),{monitorState:monitorState,actionsById:actionsById,nextActionId:nextActionId,stagedActionIds:stagedActionIds,skippedActionIds:skippedActionIds,committedState:committedState,currentStateIndex:currentStateIndex,computedStates:computedStates};var _b}}}function _createReduxDevtoolsExtension(){var legacyExtensionKey="devToolsExtension",extensionKey="__REDUX_DEVTOOLS_EXTENSION__";return"object"==typeof window&&"undefined"!=typeof window[legacyExtensionKey]?window[legacyExtensionKey]:"object"==typeof window&&"undefined"!=typeof window[extensionKey]?window[extensionKey]:null}function _createState(devtools){return devtools.state}function _createReducer(dispatcher,reducer){return new _ngrx_store.Reducer(dispatcher,reducer)}function _createStateIfExtension(extension,injector){if(extension){var devtools=injector.get(StoreDevtools);return _createState(devtools)}var initialState=injector.get(_ngrx_store.INITIAL_STATE),dispatcher=injector.get(_ngrx_store.Dispatcher),reducer=injector.get(_ngrx_store.Reducer);return new _ngrx_store.State(initialState,dispatcher,reducer)}function _createReducerIfExtension(extension,injector){if(extension){var devtoolsDispatcher=injector.get(DevtoolsDispatcher),reducer=injector.get(_ngrx_store.INITIAL_REDUCER);return _createReducer(devtoolsDispatcher,reducer)}var dispatcher=injector.get(_ngrx_store.Dispatcher),reducer=injector.get(_ngrx_store.INITIAL_REDUCER);return new _ngrx_store.Reducer(dispatcher,reducer)}function noMonitor(){return null}function _createOptions(_options){var DEFAULT_OPTIONS={monitor:noMonitor},options="function"==typeof _options?_options():_options;if(options=Object.assign({},DEFAULT_OPTIONS,options),options.maxAge&&options.maxAge<2)throw new Error("Devtools 'maxAge' cannot be less than 2, got "+options.maxAge);return options}var ActionTypes={PERFORM_ACTION:"PERFORM_ACTION",RESET:"RESET",ROLLBACK:"ROLLBACK",COMMIT:"COMMIT",SWEEP:"SWEEP",TOGGLE_ACTION:"TOGGLE_ACTION",SET_ACTIONS_ACTIVE:"SET_ACTIONS_ACTIVE",JUMP_TO_STATE:"JUMP_TO_STATE",IMPORT_STATE:"IMPORT_STATE"},StoreDevtoolActions={performAction:function(action){if("undefined"==typeof action.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');return{type:ActionTypes.PERFORM_ACTION,action:action,timestamp:Date.now()}},reset:function(){return{type:ActionTypes.RESET,timestamp:Date.now()}},rollback:function(){return{type:ActionTypes.ROLLBACK,timestamp:Date.now()}},commit:function(){return{type:ActionTypes.COMMIT,timestamp:Date.now()}},sweep:function(){return{type:ActionTypes.SWEEP}},toggleAction:function(id){return{type:ActionTypes.TOGGLE_ACTION,id:id}},setActionsActive:function(start,end,active){return void 0===active&&(active=!0),{type:ActionTypes.SET_ACTIONS_ACTIVE,start:start,end:end,active:active}},jumpToState:function(index){return{type:ActionTypes.JUMP_TO_STATE,index:index}},importState:function(nextLiftedState){return{type:ActionTypes.IMPORT_STATE,nextLiftedState:nextLiftedState}}},ExtensionActionTypes={START:"START",DISPATCH:"DISPATCH",STOP:"STOP",ACTION:"ACTION"},REDUX_DEVTOOLS_EXTENSION=new _angular_core.OpaqueToken("Redux Devtools Extension"),DevtoolsExtension=function(){function DevtoolsExtension(devtoolsExtension){this.instanceId="ngrx-store-"+Date.now(),this.devtoolsExtension=devtoolsExtension,this.createActionStreams()}return DevtoolsExtension.prototype.notify=function(action,state){this.devtoolsExtension&&this.devtoolsExtension.send(null,state,!1,this.instanceId)},DevtoolsExtension.prototype.createChangesObservable=function(){var _this=this;return this.devtoolsExtension?new rxjs_Observable.Observable(function(subscriber){var connection=_this.devtoolsExtension.connect({instanceId:_this.instanceId});return connection.subscribe(function(change){return subscriber.next(change)}),connection.unsubscribe}):rxjs_observable_empty.empty()},DevtoolsExtension.prototype.createActionStreams=function(){var _this=this,changes$=rxjs_operator_share.share.call(this.createChangesObservable()),start$=rxjs_operator_filter.filter.call(changes$,function(change){return change.type===ExtensionActionTypes.START}),stop$=rxjs_operator_filter.filter.call(changes$,function(change){return change.type===ExtensionActionTypes.STOP}),liftedActions$=applyOperators(changes$,[[rxjs_operator_filter.filter,function(change){return change.type===ExtensionActionTypes.DISPATCH}],[rxjs_operator_map.map,function(change){return _this.unwrapAction(change.payload)}]]),actions$=applyOperators(changes$,[[rxjs_operator_filter.filter,function(change){return change.type===ExtensionActionTypes.ACTION}],[rxjs_operator_map.map,function(change){return _this.unwrapAction(change.payload)}]]),actionsUntilStop$=rxjs_operator_takeUntil.takeUntil.call(actions$,stop$),liftedUntilStop$=rxjs_operator_takeUntil.takeUntil.call(liftedActions$,stop$);this.actions$=rxjs_operator_switchMap.switchMap.call(start$,function(){return actionsUntilStop$}),this.liftedActions$=rxjs_operator_switchMap.switchMap.call(start$,function(){return liftedUntilStop$})},DevtoolsExtension.prototype.unwrapAction=function(action){return"string"==typeof action?eval("("+action+")"):action},DevtoolsExtension.decorators=[{type:_angular_core.Injectable}],DevtoolsExtension.ctorParameters=[{type:void 0,decorators:[{type:_angular_core.Inject,args:[REDUX_DEVTOOLS_EXTENSION]}]}],DevtoolsExtension}(),INIT_ACTION={type:_ngrx_store.Dispatcher.INIT},STORE_DEVTOOLS_CONFIG=new _angular_core.OpaqueToken("@ngrx/devtools Options"),INITIAL_OPTIONS=new _angular_core.OpaqueToken("@ngrx/devtools Initial Config"),__extends=void 0||function(d,b){function __(){this.constructor=d}for(var p in b)b.hasOwnProperty(p)&&(d[p]=b[p]);d.prototype=null===b?Object.create(b):(__.prototype=b.prototype,new __)},DevtoolsDispatcher=function(_super){function DevtoolsDispatcher(){_super.apply(this,arguments)}return __extends(DevtoolsDispatcher,_super),DevtoolsDispatcher.decorators=[{type:_angular_core.Injectable}],DevtoolsDispatcher.ctorParameters=[],DevtoolsDispatcher}(_ngrx_store.Dispatcher),StoreDevtools=function(){function StoreDevtools(dispatcher,actions$,reducers$,extension,initialState,config){var liftedInitialState=liftInitialState(initialState,config.monitor),liftReducer=liftReducerWith(initialState,liftedInitialState,config.monitor,{maxAge:config.maxAge}),liftedAction$=applyOperators(actions$,[[rxjs_operator_skip.skip,1],[rxjs_operator_merge.merge,extension.actions$],[rxjs_operator_map.map,liftAction],[rxjs_operator_merge.merge,dispatcher,extension.liftedActions$],[rxjs_operator_observeOn.observeOn,rxjs_scheduler_queue.queue]]),liftedReducer$=rxjs_operator_map.map.call(reducers$,liftReducer),liftedStateSubject=new rxjs_ReplaySubject.ReplaySubject(1),liftedStateSubscription=applyOperators(liftedAction$,[[rxjs_operator_withLatestFrom.withLatestFrom,liftedReducer$],[rxjs_operator_scan.scan,function(liftedState,_a){var action=_a[0],reducer=_a[1],nextState=reducer(liftedState,action);return extension.notify(action,nextState),nextState},liftedInitialState]]).subscribe(liftedStateSubject),liftedState$=liftedStateSubject.asObservable(),state$=rxjs_operator_map.map.call(liftedState$,unliftState);this.stateSubscription=liftedStateSubscription,this.dispatcher=dispatcher,this.liftedState=liftedState$,this.state=state$}return StoreDevtools.prototype.dispatch=function(action){this.dispatcher.dispatch(action)},StoreDevtools.prototype.next=function(action){this.dispatcher.dispatch(action)},StoreDevtools.prototype.error=function(){},StoreDevtools.prototype.complete=function(){},StoreDevtools.prototype.performAction=function(action){this.dispatch(StoreDevtoolActions.performAction(action))},StoreDevtools.prototype.reset=function(){this.dispatch(StoreDevtoolActions.reset())},StoreDevtools.prototype.rollback=function(){this.dispatch(StoreDevtoolActions.rollback())},StoreDevtools.prototype.commit=function(){this.dispatch(StoreDevtoolActions.commit())},StoreDevtools.prototype.sweep=function(){this.dispatch(StoreDevtoolActions.sweep())},StoreDevtools.prototype.toggleAction=function(id){this.dispatch(StoreDevtoolActions.toggleAction(id))},StoreDevtools.prototype.jumpToState=function(index){this.dispatch(StoreDevtoolActions.jumpToState(index))},StoreDevtools.prototype.importState=function(nextLiftedState){this.dispatch(StoreDevtoolActions.importState(nextLiftedState))},StoreDevtools.decorators=[{type:_angular_core.Injectable}],StoreDevtools.ctorParameters=[{type:DevtoolsDispatcher},{type:_ngrx_store.Dispatcher},{type:_ngrx_store.Reducer},{type:DevtoolsExtension},{type:void 0,decorators:[{type:_angular_core.Inject,args:[_ngrx_store.INITIAL_STATE]}]},{type:void 0,decorators:[{type:_angular_core.Inject,args:[STORE_DEVTOOLS_CONFIG]}]}],StoreDevtools}(),StoreDevtoolsModule=function(){function StoreDevtoolsModule(){}return StoreDevtoolsModule.instrumentStore=function(_options){return void 0===_options&&(_options={}),{ngModule:StoreDevtoolsModule,providers:[{provide:_ngrx_store.State,deps:[StoreDevtools],useFactory:_createState},{provide:INITIAL_OPTIONS,useValue:_options},{provide:_ngrx_store.Reducer,deps:[DevtoolsDispatcher,_ngrx_store.INITIAL_REDUCER],useFactory:_createReducer},{provide:STORE_DEVTOOLS_CONFIG,deps:[INITIAL_OPTIONS],useFactory:_createOptions}]}},StoreDevtoolsModule.instrumentOnlyWithExtension=function(_options){return void 0===_options&&(_options={}),{ngModule:StoreDevtoolsModule,providers:[{provide:_ngrx_store.State,deps:[REDUX_DEVTOOLS_EXTENSION,_angular_core.Injector],useFactory:_createStateIfExtension},{provide:_ngrx_store.Reducer,deps:[REDUX_DEVTOOLS_EXTENSION,_angular_core.Injector],useFactory:_createReducerIfExtension},{provide:INITIAL_OPTIONS,useValue:_options},{provide:STORE_DEVTOOLS_CONFIG,deps:[INITIAL_OPTIONS],useFactory:_createOptions}]}},StoreDevtoolsModule.decorators=[{type:_angular_core.NgModule,args:[{imports:[_ngrx_store.StoreModule],providers:[DevtoolsExtension,DevtoolsDispatcher,StoreDevtools,{provide:REDUX_DEVTOOLS_EXTENSION,useFactory:_createReduxDevtoolsExtension}]}]}],StoreDevtoolsModule.ctorParameters=[],StoreDevtoolsModule}();exports.StoreDevtoolsModule=StoreDevtoolsModule,exports.StoreDevtools=StoreDevtools,Object.defineProperty(exports,"__esModule",{value:!0})}); |
@@ -391,2 +391,3 @@ (function (global, factory) { | ||
var STORE_DEVTOOLS_CONFIG = new _angular_core.OpaqueToken('@ngrx/devtools Options'); | ||
var INITIAL_OPTIONS = new _angular_core.OpaqueToken('@ngrx/devtools Initial Config'); | ||
@@ -531,8 +532,14 @@ var __extends = (undefined && undefined.__extends) || function (d, b) { | ||
} | ||
function _createExtensionOptions() { | ||
return { | ||
maxAge: Infinity, | ||
monitor: function () { return null; } | ||
}; | ||
function noMonitor() { | ||
return null; | ||
} | ||
function _createOptions(_options) { | ||
var DEFAULT_OPTIONS = { monitor: noMonitor }; | ||
var options = typeof _options === 'function' ? _options() : _options; | ||
options = Object.assign({}, DEFAULT_OPTIONS, options); | ||
if (options.maxAge && options.maxAge < 2) { | ||
throw new Error("Devtools 'maxAge' cannot be less than 2, got " + options.maxAge); | ||
} | ||
return options; | ||
} | ||
var StoreDevtoolsModule = (function () { | ||
@@ -543,9 +550,2 @@ function StoreDevtoolsModule() { | ||
if (_options === void 0) { _options = {}; } | ||
var DEFAULT_OPTIONS = { | ||
monitor: function () { return null; } | ||
}; | ||
var options = Object.assign({}, DEFAULT_OPTIONS, _options); | ||
if (options.maxAge && options.maxAge < 2) { | ||
throw new Error("Devtools 'maxAge' cannot be less than 2, got " + options.maxAge); | ||
} | ||
return { | ||
@@ -560,2 +560,6 @@ ngModule: StoreDevtoolsModule, | ||
{ | ||
provide: INITIAL_OPTIONS, | ||
useValue: _options | ||
}, | ||
{ | ||
provide: _ngrx_store.Reducer, | ||
@@ -565,7 +569,12 @@ deps: [DevtoolsDispatcher, _ngrx_store.INITIAL_REDUCER], | ||
}, | ||
{ provide: STORE_DEVTOOLS_CONFIG, useValue: options } | ||
{ | ||
provide: STORE_DEVTOOLS_CONFIG, | ||
deps: [INITIAL_OPTIONS], | ||
useFactory: _createOptions | ||
} | ||
] | ||
}; | ||
}; | ||
StoreDevtoolsModule.instrumentOnlyWithExtension = function () { | ||
StoreDevtoolsModule.instrumentOnlyWithExtension = function (_options) { | ||
if (_options === void 0) { _options = {}; } | ||
return { | ||
@@ -585,4 +594,9 @@ ngModule: StoreDevtoolsModule, | ||
{ | ||
provide: INITIAL_OPTIONS, | ||
useValue: _options | ||
}, | ||
{ | ||
provide: STORE_DEVTOOLS_CONFIG, | ||
useFactory: _createExtensionOptions | ||
deps: [INITIAL_OPTIONS], | ||
useFactory: _createOptions | ||
} | ||
@@ -589,0 +603,0 @@ ] |
{ | ||
"name": "@ngrx/store-devtools", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "Developer tools for @ngrx/store", | ||
@@ -5,0 +5,0 @@ "main": "./bundles/store-devtools.umd.js", |
@@ -12,3 +12,3 @@ # @ngrx/store-devtools | ||
## Instrumentation | ||
### Instrumentation with the Chrome Extension (Preferred) | ||
### Instrumentation with the Chrome / Firefox Extension (Preferred) | ||
@@ -25,3 +25,6 @@ 1. Download the [Redux Devtools Extension](http://zalmoxisus.github.io/redux-devtools-extension/) | ||
StoreModule.provideStore(rootReducer), | ||
StoreDevtoolsModule.instrumentOnlyWithExtension() | ||
// Note that you must instrument after importing StoreModule | ||
StoreDevtoolsModule.instrumentOnlyWithExtension({ | ||
maxAge: 5 | ||
}) | ||
] | ||
@@ -33,3 +36,3 @@ }) | ||
### Instrumentation with a Custom Monitor | ||
To instrument @ngrx/store and use the devtools with a custom monitor you will need to setup the | ||
To instrument @ngrx/store and use the devtools with a custom monitor you will need to setup the | ||
instrumentation providers using `instrumentStore()`: | ||
@@ -36,0 +39,0 @@ |
@@ -8,1 +8,2 @@ import { ActionReducer } from '@ngrx/store'; | ||
export declare const STORE_DEVTOOLS_CONFIG: OpaqueToken; | ||
export declare const INITIAL_OPTIONS: OpaqueToken; |
import { OpaqueToken } from '@angular/core'; | ||
export var STORE_DEVTOOLS_CONFIG = new OpaqueToken('@ngrx/devtools Options'); | ||
export var INITIAL_OPTIONS = new OpaqueToken('@ngrx/devtools Initial Config'); | ||
//# sourceMappingURL=config.js.map |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"STORE_DEVTOOLS_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["@ngrx/devtools Options"]}}} | ||
{"__symbolic":"module","version":1,"metadata":{"STORE_DEVTOOLS_CONFIG":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["@ngrx/devtools Options"]},"INITIAL_OPTIONS":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@angular/core","name":"OpaqueToken"},"arguments":["@ngrx/devtools Initial Config"]}}} |
@@ -1,3 +0,3 @@ | ||
import { OpaqueToken, Injector, ModuleWithProviders } from '@angular/core'; | ||
import { State, Reducer } from '@ngrx/store'; | ||
import { Injector, ModuleWithProviders } from '@angular/core'; | ||
import { Reducer } from '@ngrx/store'; | ||
import { Observable } from 'rxjs/Observable'; | ||
@@ -11,20 +11,7 @@ import { StoreDevtools, DevtoolsDispatcher } from './devtools'; | ||
export declare function _createReducerIfExtension(extension: any, injector: Injector): Reducer; | ||
export declare function _createExtensionOptions(): StoreDevtoolsConfig; | ||
export declare function noMonitor(): any; | ||
export declare function _createOptions(_options: any): StoreDevtoolsConfig; | ||
export declare class StoreDevtoolsModule { | ||
static instrumentStore(_options?: StoreDevtoolsConfig): { | ||
ngModule: typeof StoreDevtoolsModule; | ||
providers: ({ | ||
provide: typeof State; | ||
deps: typeof StoreDevtools[]; | ||
useFactory: (devtools: StoreDevtools) => Observable<any>; | ||
} | { | ||
provide: typeof Reducer; | ||
deps: (OpaqueToken | typeof DevtoolsDispatcher)[]; | ||
useFactory: (dispatcher: DevtoolsDispatcher, reducer: any) => Reducer; | ||
} | { | ||
provide: OpaqueToken; | ||
useValue: {} & StoreDevtoolsConfig; | ||
})[]; | ||
}; | ||
static instrumentOnlyWithExtension(): ModuleWithProviders; | ||
static instrumentStore(_options?: StoreDevtoolsConfig | (() => StoreDevtoolsConfig)): ModuleWithProviders; | ||
static instrumentOnlyWithExtension(_options?: StoreDevtoolsConfig | (() => StoreDevtoolsConfig)): ModuleWithProviders; | ||
} |
import { NgModule, Injector } from '@angular/core'; | ||
import { StoreModule, State, INITIAL_STATE, INITIAL_REDUCER, Dispatcher, Reducer } from '@ngrx/store'; | ||
import { StoreDevtools, DevtoolsDispatcher } from './devtools'; | ||
import { STORE_DEVTOOLS_CONFIG } from './config'; | ||
import { STORE_DEVTOOLS_CONFIG, INITIAL_OPTIONS } from './config'; | ||
import { DevtoolsExtension, REDUX_DEVTOOLS_EXTENSION } from './extension'; | ||
@@ -49,8 +49,14 @@ export function _createReduxDevtoolsExtension() { | ||
} | ||
export function _createExtensionOptions() { | ||
return { | ||
maxAge: Infinity, | ||
monitor: function () { return null; } | ||
}; | ||
export function noMonitor() { | ||
return null; | ||
} | ||
export function _createOptions(_options) { | ||
var DEFAULT_OPTIONS = { monitor: noMonitor }; | ||
var options = typeof _options === 'function' ? _options() : _options; | ||
options = Object.assign({}, DEFAULT_OPTIONS, options); | ||
if (options.maxAge && options.maxAge < 2) { | ||
throw new Error("Devtools 'maxAge' cannot be less than 2, got " + options.maxAge); | ||
} | ||
return options; | ||
} | ||
export var StoreDevtoolsModule = (function () { | ||
@@ -61,9 +67,2 @@ function StoreDevtoolsModule() { | ||
if (_options === void 0) { _options = {}; } | ||
var DEFAULT_OPTIONS = { | ||
monitor: function () { return null; } | ||
}; | ||
var options = Object.assign({}, DEFAULT_OPTIONS, _options); | ||
if (options.maxAge && options.maxAge < 2) { | ||
throw new Error("Devtools 'maxAge' cannot be less than 2, got " + options.maxAge); | ||
} | ||
return { | ||
@@ -78,2 +77,6 @@ ngModule: StoreDevtoolsModule, | ||
{ | ||
provide: INITIAL_OPTIONS, | ||
useValue: _options | ||
}, | ||
{ | ||
provide: Reducer, | ||
@@ -83,7 +86,12 @@ deps: [DevtoolsDispatcher, INITIAL_REDUCER], | ||
}, | ||
{ provide: STORE_DEVTOOLS_CONFIG, useValue: options } | ||
{ | ||
provide: STORE_DEVTOOLS_CONFIG, | ||
deps: [INITIAL_OPTIONS], | ||
useFactory: _createOptions | ||
} | ||
] | ||
}; | ||
}; | ||
StoreDevtoolsModule.instrumentOnlyWithExtension = function () { | ||
StoreDevtoolsModule.instrumentOnlyWithExtension = function (_options) { | ||
if (_options === void 0) { _options = {}; } | ||
return { | ||
@@ -103,4 +111,9 @@ ngModule: StoreDevtoolsModule, | ||
{ | ||
provide: INITIAL_OPTIONS, | ||
useValue: _options | ||
}, | ||
{ | ||
provide: STORE_DEVTOOLS_CONFIG, | ||
useFactory: _createExtensionOptions | ||
deps: [INITIAL_OPTIONS], | ||
useFactory: _createOptions | ||
} | ||
@@ -107,0 +120,0 @@ ] |
@@ -1,1 +0,1 @@ | ||
{"__symbolic":"module","version":1,"metadata":{"_createState":{"__symbolic":"function","parameters":["devtools"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"devtools"},"member":"state"}},"_createReducer":{"__symbolic":"function","parameters":["dispatcher","reducer"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@ngrx/store","name":"Reducer"},"arguments":[{"__symbolic":"reference","name":"dispatcher"},{"__symbolic":"reference","name":"reducer"}]}},"_createExtensionOptions":{"__symbolic":"function","parameters":[],"value":{"__symbolic":"error","message":"Function call not supported","line":64,"character":13}},"StoreDevtoolsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@ngrx/store","name":"StoreModule"}],"providers":[{"__symbolic":"reference","module":"./extension","name":"DevtoolsExtension"},{"__symbolic":"reference","module":"./devtools","name":"DevtoolsDispatcher"},{"__symbolic":"reference","module":"./devtools","name":"StoreDevtools"},{"provide":{"__symbolic":"reference","module":"./extension","name":"REDUX_DEVTOOLS_EXTENSION"},"useFactory":{"__symbolic":"reference","name":"_createReduxDevtoolsExtension"}}]}]}],"statics":{"instrumentOnlyWithExtension":{"__symbolic":"function","parameters":[],"value":{"ngModule":{"__symbolic":"reference","name":"StoreDevtoolsModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngrx/store","name":"State"},"deps":[{"__symbolic":"reference","module":"./extension","name":"REDUX_DEVTOOLS_EXTENSION"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}],"useFactory":{"__symbolic":"reference","name":"_createStateIfExtension"}},{"provide":{"__symbolic":"reference","module":"@ngrx/store","name":"Reducer"},"deps":[{"__symbolic":"reference","module":"./extension","name":"REDUX_DEVTOOLS_EXTENSION"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}],"useFactory":{"__symbolic":"reference","name":"_createReducerIfExtension"}},{"provide":{"__symbolic":"reference","module":"./config","name":"STORE_DEVTOOLS_CONFIG"},"useFactory":{"__symbolic":"reference","name":"_createExtensionOptions"}}]}}}}}} | ||
{"__symbolic":"module","version":1,"metadata":{"_createState":{"__symbolic":"function","parameters":["devtools"],"value":{"__symbolic":"select","expression":{"__symbolic":"reference","name":"devtools"},"member":"state"}},"_createReducer":{"__symbolic":"function","parameters":["dispatcher","reducer"],"value":{"__symbolic":"new","expression":{"__symbolic":"reference","module":"@ngrx/store","name":"Reducer"},"arguments":[{"__symbolic":"reference","name":"dispatcher"},{"__symbolic":"reference","name":"reducer"}]}},"noMonitor":{"__symbolic":"function","parameters":[],"value":null},"StoreDevtoolsModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"imports":[{"__symbolic":"reference","module":"@ngrx/store","name":"StoreModule"}],"providers":[{"__symbolic":"reference","module":"./extension","name":"DevtoolsExtension"},{"__symbolic":"reference","module":"./devtools","name":"DevtoolsDispatcher"},{"__symbolic":"reference","module":"./devtools","name":"StoreDevtools"},{"provide":{"__symbolic":"reference","module":"./extension","name":"REDUX_DEVTOOLS_EXTENSION"},"useFactory":{"__symbolic":"reference","name":"_createReduxDevtoolsExtension"}}]}]}],"statics":{"instrumentStore":{"__symbolic":"function","parameters":["_options"],"value":{"ngModule":{"__symbolic":"reference","name":"StoreDevtoolsModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngrx/store","name":"State"},"deps":[{"__symbolic":"reference","module":"./devtools","name":"StoreDevtools"}],"useFactory":{"__symbolic":"reference","name":"_createState"}},{"provide":{"__symbolic":"reference","module":"./config","name":"INITIAL_OPTIONS"},"useValue":{"__symbolic":"reference","name":"_options"}},{"provide":{"__symbolic":"reference","module":"@ngrx/store","name":"Reducer"},"deps":[{"__symbolic":"reference","module":"./devtools","name":"DevtoolsDispatcher"},{"__symbolic":"reference","module":"@ngrx/store","name":"INITIAL_REDUCER"}],"useFactory":{"__symbolic":"reference","name":"_createReducer"}},{"provide":{"__symbolic":"reference","module":"./config","name":"STORE_DEVTOOLS_CONFIG"},"deps":[{"__symbolic":"reference","module":"./config","name":"INITIAL_OPTIONS"}],"useFactory":{"__symbolic":"reference","name":"_createOptions"}}]},"defaults":[{}]},"instrumentOnlyWithExtension":{"__symbolic":"function","parameters":["_options"],"value":{"ngModule":{"__symbolic":"reference","name":"StoreDevtoolsModule"},"providers":[{"provide":{"__symbolic":"reference","module":"@ngrx/store","name":"State"},"deps":[{"__symbolic":"reference","module":"./extension","name":"REDUX_DEVTOOLS_EXTENSION"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}],"useFactory":{"__symbolic":"reference","name":"_createStateIfExtension"}},{"provide":{"__symbolic":"reference","module":"@ngrx/store","name":"Reducer"},"deps":[{"__symbolic":"reference","module":"./extension","name":"REDUX_DEVTOOLS_EXTENSION"},{"__symbolic":"reference","module":"@angular/core","name":"Injector"}],"useFactory":{"__symbolic":"reference","name":"_createReducerIfExtension"}},{"provide":{"__symbolic":"reference","module":"./config","name":"INITIAL_OPTIONS"},"useValue":{"__symbolic":"reference","name":"_options"}},{"provide":{"__symbolic":"reference","module":"./config","name":"STORE_DEVTOOLS_CONFIG"},"deps":[{"__symbolic":"reference","module":"./config","name":"INITIAL_OPTIONS"}],"useFactory":{"__symbolic":"reference","name":"_createOptions"}}]},"defaults":[{}]}}}}} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
142243
1469
58