Created
July 14, 2021 10:50
-
-
Save mattmook/cfaecf5040f032d484739a40e45a075d to your computer and use it in GitHub Desktop.
The state of MVI on Android - ReduxKotlin - subscribe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lifecycleScope.launchWhenCreated { | |
suspendCancellableCoroutine { continuation -> | |
val unsubscribe = viewModel.store.subscribe { | |
render(viewModel.store.state) | |
} | |
continuation.invokeOnCancellation { | |
unsubscribe() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment