All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.com.huanshankeji.compose.runtime.DeferredComposableRunner.kt Maven / Gradle / Ivy

Go to download

Common wrappers of components (including layouts) and modifiers for Compose UI (Android, desktop (JVM), iOS, and web (Kotlin/Wasm)) and Compose HTML

The newest version!
package com.huanshankeji.compose.runtime

import androidx.compose.runtime.Composable

class DeferredComposableRunner {
    private var composables: MutableList<@Composable () -> Unit>? = null
    fun addComposable(composable: @Composable () -> Unit) {
        composables!!.add(composable)
    }

    /** Add the composable functions with the non-composable functions and then invoke them. */
    @Composable
    fun ComposableRun(content: () -> Unit) {
        composables = mutableListOf()
        content()
        for (composable in composables!!)
            composable()
        composables = null
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy