andylamax
05/29/2022, 1:19 AMCasey Brooks
05/30/2022, 3:03 PM.invokeOnCompletion
to do the cleanup stuff.
I recently released [Ballast](https://github.com/copper-leaf/ballast) which does this, and also provides a robust MVI pattern on top and useful utilities like state restoration and time-travel debugging to make it easy to understand and work with on all Kotlin platforms, which you may be interested inCasey Brooks
05/30/2022, 3:08 PMandylamax
05/30/2022, 5:44 PMCasey Brooks
05/30/2022, 6:19 PMGlobalScope
, then it will live forever. But if you're using #compose-desktop you can get a CoroutineScope scoped to a particular Composable function and have it live for a shorter period of time, as long as that bit of UI is visible. By passing a CoroutineScope in through the constructor, you can choose exactly how long you want the ViewModel to live when you create itandylamax
05/30/2022, 8:58 PMArkadii Ivanov
06/02/2022, 11:14 PM