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

divkit.dsl.DataUtils.kt Maven / Gradle / Ivy

Go to download

DivKit is an open source Server-Driven UI (SDUI) framework. SDUI is a an emerging technique that leverage the server to build the user interfaces of their mobile app.

There is a newer version: 30.19.0
Show newest version
package divkit.dsl

import divkit.dsl.core.Guard
import divkit.dsl.core.value
import divkit.dsl.scope.DivScope

/**
 * @param div Contents.
 */
fun DivScope.singleRoot(div: Div): List =
    Data.State(
        Data.State.Properties(
            stateId = value(0),
            div = value(div),
        )
    ).asList()

/**
 * Creates [Data] with single state.
 */
fun DivScope.data(
    @Suppress("UNUSED_PARAMETER") `use named arguments`: Guard = Guard.instance,
    logId: String,
    div: Div,
    timers: List? = null,
    variableTriggers: List? = null,
    variables: List? = null,
): Data {
    return data(
        logId = logId,
        states = singleRoot(
            div = div
        ),
        timers = timers,
        variableTriggers = variableTriggers,
        variables = variables
    )
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy