create

fun create(context: KpaElement? = null, clock: Clock = Clock.System, configure: KbEnvironmentBuilder.() -> Unit = {}): KbEnvironment(source)

Creates a new KbEnvironment backed by the supplied context.

Return

a new KbEnvironment.

Parameters

context

the kPointer element used to resolve interpolation identifiers, or null for no context.

clock

the clock used to seed the default now environment property; defaults to Clock.System. The instant is captured once, when the environment is created, so every @env/now reference within the resulting environment observes the same value.

configure

a DSL lambda for registering transforms and properties on the environment. The builder starts with the default transforms and the default properties (such as now) pre-registered. Apps can KbEnvironmentBuilder.addTransform / KbEnvironmentBuilder.addProperty new entries, KbEnvironmentBuilder.overrideTransform / KbEnvironmentBuilder.overrideProperty existing ones, or KbEnvironmentBuilder.removeTransform / KbEnvironmentBuilder.removeProperty them.