Exporter

class Exporter<T : Any>(initialize: Exporter<T>.() -> Unit)

An Exporter is a simple container for capturing some return value. Its main purpose is to reduce boilerplate code if the value to be returned is created within some nested structure and would therefor need some preliminary defined var outside the structure and some explicit return of the value afterwards.

It is best used implicitly by the corresponding export function.

// function wants to return an inner Tag `input`
fun RenderContext.renderSomeStructure() : HtmlTag<HTMLInputElement> {
return export {
// ^^^^^^^^^^^^^
// return captured value
div {
export(input {
// ^^^^^^^^^^^^
// capture the needed value; the input tag in this case!
type("text")
value(someStore.data)
})
}
}
}

Constructors

Link copied to clipboard
fun <T : Any> Exporter(initialize: Exporter<T>.() -> Unit)

Functions

Link copied to clipboard
fun export(payload: T): T

Properties

Link copied to clipboard
lateinit var payload: T