diff options
author | Robert Jaros <rjaros@finn.pl> | 2019-10-17 21:58:34 +0200 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2019-10-17 21:58:34 +0200 |
commit | 736b80835f67c9c34657074ebcfbe0752bef1c18 (patch) | |
tree | 82d1e18a9ec07692dfe5dd31f470b842a9950a89 /src/main/kotlin/pl/treksoft/kvision/html/H3.kt | |
parent | 53b325d52208bfd44ba6a524ce3dda5379aed699 (diff) | |
download | kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.gz kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.tar.bz2 kvision-736b80835f67c9c34657074ebcfbe0752bef1c18.zip |
Move DSL builder functions out of the companion objects (#93)
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html/H3.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/H3.kt | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/H3.kt b/src/main/kotlin/pl/treksoft/kvision/html/H3.kt index af71cdc5..1a2efdbb 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/H3.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/H3.kt @@ -46,23 +46,21 @@ open class H3( @Suppress("LeakingThis") init?.invoke(this) } +} - companion object { - /** - * DSL builder extension function. - * - * It takes the same parameters as the constructor of the built component. - */ - fun Container.h3( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (H3.() -> Unit)? = null - ): H3 { - val h3 = H3(content, rich, align, classes).apply { init?.invoke(this) } - this.add(h3) - return h3 - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.h3( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (H3.() -> Unit)? = null +): H3 { + val h3 = H3(content, rich, align, classes).apply { init?.invoke(this) } + this.add(h3) + return h3 } |