divkit.dsl.DataUtils.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-json-builder Show documentation
Show all versions of kotlin-json-builder Show documentation
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.
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
)
}