From d32318661a3ed7ba71120cb6003abf50c18f85be Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 8 Jul 2019 22:20:22 +0200 Subject: Support for redux-devtools-extension --- .../src/main/kotlin/pl/treksoft/kvision/KVManagerRedux.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'kvision-modules/kvision-redux/src/main/kotlin/pl') diff --git a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/KVManagerRedux.kt b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/KVManagerRedux.kt index 4b51ff19..346f623d 100644 --- a/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/KVManagerRedux.kt +++ b/kvision-modules/kvision-redux/src/main/kotlin/pl/treksoft/kvision/KVManagerRedux.kt @@ -26,6 +26,7 @@ import redux.Enhancer import redux.Middleware import redux.Reducer import redux.Store +import kotlin.browser.window internal val kVManagerReduxInit = KVManagerRedux.init() @@ -64,6 +65,11 @@ internal object KVManagerRedux { @Suppress("UnsafeCastFromDynamic") internal fun compose(function1: (T1) -> R, function2: (A) -> T1): (A) -> R { - return redux.compose(function1, function2) + val composeEnhancers = if (window.asDynamic().__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ != undefined) { + window.asDynamic().__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ + } else { + redux.compose + } + return composeEnhancers(function1, function2) } } -- cgit