diff options
author | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-24 11:48:33 +0100 |
---|---|---|
committer | Joffrey Bion <joffrey.bion@booking.com> | 2020-03-24 11:48:54 +0100 |
commit | 10447dded5583531075b14d20803bb32af02e630 (patch) | |
tree | bb748373fe4b07862d8b9fe65f6fc6084bec8f27 /sw-ui-kt/src/main | |
parent | Reorganize reducers to fix game start button (diff) | |
download | seven-wonders-10447dded5583531075b14d20803bb32af02e630.tar.gz seven-wonders-10447dded5583531075b14d20803bb32af02e630.tar.bz2 seven-wonders-10447dded5583531075b14d20803bb32af02e630.zip |
Enable redux dev tools
Diffstat (limited to 'sw-ui-kt/src/main')
-rw-r--r-- | sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Store.kt | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Store.kt b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Store.kt index 44237794..84c0f892 100644 --- a/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Store.kt +++ b/sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Store.kt @@ -5,16 +5,19 @@ import redux.RAction import redux.Store import redux.WrapperAction import redux.applyMiddleware -import redux.compose import redux.createStore import redux.rEnhancer +import kotlin.browser.window val INITIAL_STATE = SwState() +private fun <A, T1, R> composeWithDevTools(function1: (T1) -> R, function2: (A) -> T1): (A) -> R = + window.asDynamic().__REDUX_DEVTOOLS_EXTENSION_COMPOSE__(function1, function2) as Function1<A, R> + fun configureStore( sagaManager: SagaManager<SwState, RAction, WrapperAction>, initialState: SwState = INITIAL_STATE ): Store<SwState, RAction, WrapperAction> { val sagaEnhancer = applyMiddleware(sagaManager.createMiddleware()) - return createStore(::rootReducer, initialState, compose(sagaEnhancer, rEnhancer())) + return createStore(::rootReducer, initialState, composeWithDevTools(sagaEnhancer, rEnhancer())) } |