Skip to content

Instantly share code, notes, and snippets.

@GeePawHill
Created August 10, 2022 01:49
Show Gist options
  • Select an option

  • Save GeePawHill/9d4bb8a21531f369e90be5e86207a2bb to your computer and use it in GitHub Desktop.

Select an option

Save GeePawHill/9d4bb8a21531f369e90be5e86207a2bb to your computer and use it in GitHub Desktop.
A Real World Kotlin Builder
// Snippet one: This code creates an ImageView control inside of a Pane.
val root = pane {
imageview {
image = Image("/bucket.png")
isPreserveRatio = true
}
}
// Snippet two: This is the signature of the function imageview that's being called in the above snippet
fun EventTarget.imageview(url: String? = null, lazyload: Boolean = true, op: ImageView.() -> Unit = {}) {
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment