diff options
Diffstat (limited to 'src/main/kotlin/pl/treksoft/kvision/html/Span.kt')
-rw-r--r-- | src/main/kotlin/pl/treksoft/kvision/html/Span.kt | 34 |
1 files changed, 16 insertions, 18 deletions
diff --git a/src/main/kotlin/pl/treksoft/kvision/html/Span.kt b/src/main/kotlin/pl/treksoft/kvision/html/Span.kt index bc5e93cd..862d0b2f 100644 --- a/src/main/kotlin/pl/treksoft/kvision/html/Span.kt +++ b/src/main/kotlin/pl/treksoft/kvision/html/Span.kt @@ -46,23 +46,21 @@ open class Span( @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.span( - content: String? = null, - rich: Boolean = false, - align: Align? = null, - classes: Set<String> = setOf(), - init: (Span.() -> Unit)? = null - ): Span { - val span = Span(content, rich, align, classes).apply { init?.invoke(this) } - this.add(span) - return span - } - } +/** + * DSL builder extension function. + * + * It takes the same parameters as the constructor of the built component. + */ +fun Container.span( + content: String? = null, + rich: Boolean = false, + align: Align? = null, + classes: Set<String> = setOf(), + init: (Span.() -> Unit)? = null +): Span { + val span = Span(content, rich, align, classes).apply { init?.invoke(this) } + this.add(span) + return span } |