LifecycleViewModel

abstract class LifecycleViewModel(val subscribables: List<LifecycleSubscribable> = emptyList()) : ViewModel

Optional Compose-Multiplatform ViewModel base class for Kaluga lifecycle-aware features. Holds an opt-in list of LifecycleSubscribables; the screen-side @Composable calls AttachToCompose once and all of them get wired to the current Compose host's lifecycle.

Extending this class is not required — any ViewModel can hold a LifecycleSubscribable field and call field.AttachToCompose() manually. This is purely a convenience for the common "VM owns N subscribables" case.

Parameters

subscribables

the subscribables to drive when AttachToCompose is invoked.

Constructors

Link copied to clipboard
constructor(subscribables: List<LifecycleSubscribable> = emptyList())

Properties

Link copied to clipboard

Functions

Link copied to clipboard
expect open fun addCloseable(closeable: AutoCloseable)
expect fun addCloseable(key: String, closeable: AutoCloseable)
Link copied to clipboard
expect fun <T : AutoCloseable> getCloseable(key: String): T?