@@ -14,7 +14,7 @@ import {
1414 INITIAL_REDUCERS ,
1515 REDUCER_FACTORY } from '@ngrx/store' ;
1616import { StoreDevtools , DevtoolsDispatcher } from './devtools' ;
17- import { StoreDevtoolsConfig , StoreDevtoolsOptions , STORE_DEVTOOLS_CONFIG , INITIAL_OPTIONS , SHOULD_INSTRUMENT } from './config' ;
17+ import { StoreDevtoolsConfig , StoreDevtoolsOptions , STORE_DEVTOOLS_CONFIG , INITIAL_OPTIONS } from './config' ;
1818import { DevtoolsExtension , REDUX_DEVTOOLS_EXTENSION , ReduxDevtoolsExtension } from './extension' ;
1919
2020
@@ -40,12 +40,8 @@ export function createReduxDevtoolsExtension() {
4040 }
4141}
4242
43- export function createStateObservable ( shouldInstrument : boolean , injector : Injector ) {
44- return shouldInstrument ? injector . get ( StoreDevtools ) . state : injector . get ( State ) ;
45- }
46-
47- export function createReducerManagerDispatcher ( shouldInstrument : boolean , injector : Injector ) {
48- return shouldInstrument ? injector . get ( DevtoolsDispatcher ) : injector . get ( ActionsSubject ) ;
43+ export function createStateObservable ( devtools : StoreDevtools ) {
44+ return devtools . state ;
4945}
5046
5147export function noMonitor ( ) : null {
@@ -55,8 +51,7 @@ export function noMonitor(): null {
5551export function createConfig ( _options : StoreDevtoolsOptions ) : StoreDevtoolsConfig {
5652 const DEFAULT_OPTIONS : StoreDevtoolsConfig = {
5753 maxAge : false ,
58- monitor : noMonitor ,
59- shouldInstrument : IS_EXTENSION_OR_MONITOR_PRESENT ,
54+ monitor : noMonitor
6055 } ;
6156
6257 let options = typeof _options === 'function' ? _options ( ) : _options ;
@@ -69,10 +64,6 @@ export function createConfig(_options: StoreDevtoolsOptions): StoreDevtoolsConfi
6964 return config ;
7065}
7166
72- export function createShouldInstrument ( injector : Injector , config : StoreDevtoolsConfig ) {
73- return injector . get ( config . shouldInstrument ) ;
74- }
75-
7667@NgModule ( {
7768 imports : [
7869 StoreModule
@@ -101,25 +92,19 @@ export class StoreDevtoolsModule {
10192 provide : REDUX_DEVTOOLS_EXTENSION ,
10293 useFactory : createReduxDevtoolsExtension
10394 } ,
104- {
105- provide : SHOULD_INSTRUMENT ,
106- deps : [ Injector , STORE_DEVTOOLS_CONFIG ] ,
107- useFactory : createShouldInstrument
108- } ,
10995 {
11096 provide : STORE_DEVTOOLS_CONFIG ,
11197 deps : [ INITIAL_OPTIONS ] ,
11298 useFactory : createConfig
11399 } ,
114100 {
115101 provide : StateObservable ,
116- deps : [ SHOULD_INSTRUMENT , Injector ] ,
102+ deps : [ StoreDevtools ] ,
117103 useFactory : createStateObservable
118104 } ,
119105 {
120106 provide : ReducerManagerDispatcher ,
121- deps : [ SHOULD_INSTRUMENT , Injector ] ,
122- useFactory : createReducerManagerDispatcher
107+ useExisting : DevtoolsDispatcher
123108 } ,
124109 ]
125110 } ;
0 commit comments