Package-level declarations

Types

Functions

Link copied to clipboard

添加事件监听

Link copied to clipboard
expect fun createLifecycleOwnerDelegate(viewModelStoreProvider: MRouterViewModelStoreProvider?, hostLifecycleState: Lifecycle.State = Lifecycle.State.CREATED, immutableArgs: Bundle?): LifecycleOwnerDelegate
actual fun createLifecycleOwnerDelegate(viewModelStoreProvider: MRouterViewModelStoreProvider?, hostLifecycleState: Lifecycle.State, immutableArgs: Bundle?): LifecycleOwnerDelegate
actual fun createLifecycleOwnerDelegate(viewModelStoreProvider: MRouterViewModelStoreProvider?, hostLifecycleState: Lifecycle.State, immutableArgs: Bundle?): LifecycleOwnerDelegate
actual fun createLifecycleOwnerDelegate(viewModelStoreProvider: MRouterViewModelStoreProvider?, hostLifecycleState: Lifecycle.State, immutableArgs: Bundle?): LifecycleOwnerDelegate
Link copied to clipboard

用于构造简单的ViewModel的工厂

Link copied to clipboard
inline fun <T : Any> getKClassForGenericType(): KClass<T>
Link copied to clipboard
actual fun LifecycleOwnerDelegate.LocalOwnersProvider(saveableStateHolder: SaveableStateHolder, pageScope: PageScope, content: () -> Unit)
expect fun LifecycleOwnerDelegate.LocalOwnersProvider(saveableStateHolder: SaveableStateHolder, pageScope: PageScope, content: @Composable () -> Unit)
actual fun LifecycleOwnerDelegate.LocalOwnersProvider(saveableStateHolder: SaveableStateHolder, pageScope: PageScope, content: () -> Unit)
actual fun LifecycleOwnerDelegate.LocalOwnersProvider(saveableStateHolder: SaveableStateHolder, pageScope: PageScope, content: () -> Unit)
actual fun LifecycleOwnerDelegate.LocalOwnersProvider(saveableStateHolder: SaveableStateHolder, pageScope: PageScope, content: () -> Unit)
Link copied to clipboard
inline fun <VM : ViewModel> viewModel(noinline block: () -> VM, key: String? = null): VM

用于构造具有空构造函数的ViewModel,如果需要更加强大的构造方式可以使用其他第三方库,比如koin

inline fun <VM : ViewModel> viewModel(noinline block: (SavedStateHandle) -> VM, key: String? = null): VM

用于构造有且只有SavedStateHandle作为参数的构造函数的ViewModel

Link copied to clipboard
fun <T : ViewModel> viewModelImpl(modelClass: KClass<T>, emptyBlock: () -> T? = null, block: (SavedStateHandle) -> T? = null, key: String? = null): T

实际构造ViewModel的方法