aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-redux-kotlin/src/main
diff options
context:
space:
mode:
authorRobert Jaros <rjaros@finn.pl>2019-10-13 20:04:35 +0200
committerRobert Jaros <rjaros@finn.pl>2019-10-13 20:04:35 +0200
commitfb41b9fbdb8e298d5cb69168dd53a6945a6348b1 (patch)
tree2713808a67e6360c28244dddaa6de202a3dfc9d3 /kvision-modules/kvision-redux-kotlin/src/main
parent780c340a481676e27398dccf4503e8f0b9c63060 (diff)
downloadkvision-fb41b9fbdb8e298d5cb69168dd53a6945a6348b1.tar.gz
kvision-fb41b9fbdb8e298d5cb69168dd53a6945a6348b1.tar.bz2
kvision-fb41b9fbdb8e298d5cb69168dd53a6945a6348b1.zip
Allow to unsubscribe from the ObservableState.
Diffstat (limited to 'kvision-modules/kvision-redux-kotlin/src/main')
-rw-r--r--kvision-modules/kvision-redux-kotlin/src/main/kotlin/pl/treksoft/kvision/redux/ReduxStore.kt6
1 files changed, 3 insertions, 3 deletions
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<S : Any, A : RAction>(
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())
}
}