From fb41b9fbdb8e298d5cb69168dd53a6945a6348b1 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sun, 13 Oct 2019 20:04:35 +0200 Subject: Allow to unsubscribe from the ObservableState. --- .../src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'kvision-modules/kvision-redux-kotlin/src') diff --git a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt index a37f1ac9..c4889567 100644 --- a/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt +++ b/kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt @@ -96,10 +96,10 @@ class ReduxStore( store.dispatch(thunk) } - override fun subscribe(observer: (S) -> Unit) { - store.subscribe { + override fun subscribe(observer: (S) -> Unit): () -> Unit { + observer(getState()) + return store.subscribe { observer(getState()) } - observer(getState()) } } -- cgit