summaryrefslogtreecommitdiff
path: root/sw-ui-kt/src/main/kotlin/org
diff options
context:
space:
mode:
authorJoffrey Bion <joffrey.bion@booking.com>2020-03-26 20:39:42 +0100
committerJoffrey Bion <joffrey.bion@booking.com>2020-03-27 10:59:39 +0100
commit7d4c12bc90a7496252d670966918b93e0c00a34a (patch)
tree9e7d8e01af38c2b1c68c9996371358ec8ab76330 /sw-ui-kt/src/main/kotlin/org
parentRemove gameId parameter for the game scene route (diff)
downloadseven-wonders-7d4c12bc90a7496252d670966918b93e0c00a34a.tar.gz
seven-wonders-7d4c12bc90a7496252d670966918b93e0c00a34a.tar.bz2
seven-wonders-7d4c12bc90a7496252d670966918b93e0c00a34a.zip
Use plain redux compose when devtools not present
Diffstat (limited to 'sw-ui-kt/src/main/kotlin/org')
-rw-r--r--sw-ui-kt/src/main/kotlin/org/luxons/sevenwonders/ui/redux/Store.kt10
1 files changed, 8 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 84c0f892..6f50a627 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,14 +5,20 @@ 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>
+private fun <A, T1, R> composeWithDevTools(function1: (T1) -> R, function2: (A) -> T1): (A) -> R {
+ val reduxDevtoolsExtensionCompose = window.asDynamic().__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
+ if (reduxDevtoolsExtensionCompose == undefined) {
+ return compose(function1, function2)
+ }
+ return reduxDevtoolsExtensionCompose(function1, function2) as Function1<A, R>
+}
fun configureStore(
sagaManager: SagaManager<SwState, RAction, WrapperAction>,
bgstack15