From a407d7e486d590b82e852290c6cf5a0a9a663b3a Mon Sep 17 00:00:00 2001 From: rnentjes Date: Sun, 17 Nov 2019 20:37:46 +0100 Subject: [PATCH] Testing builder call syntax --- build.gradle | 2 +- komp.iml | 6 +++--- src/main/kotlin/nl/astraeus/komp/Komponent.kt | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index beec3c6..bb779b3 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'nl.astraeus' -version '0.1.10' +version '0.1.14-SNAPSHOT' apply plugin: 'kotlin2js' apply plugin: 'kotlin-dce-js' diff --git a/komp.iml b/komp.iml index dcc02e8..6fc34e8 100644 --- a/komp.iml +++ b/komp.iml @@ -1,5 +1,5 @@ - + @@ -34,8 +34,8 @@ - - + + diff --git a/src/main/kotlin/nl/astraeus/komp/Komponent.kt b/src/main/kotlin/nl/astraeus/komp/Komponent.kt index 6c6a645..d047306 100644 --- a/src/main/kotlin/nl/astraeus/komp/Komponent.kt +++ b/src/main/kotlin/nl/astraeus/komp/Komponent.kt @@ -26,14 +26,15 @@ abstract class Komponent { open fun create(): HTMLElement { val consumer = HtmlBuilder(this, document) - val result = render(consumer) + consumer.render() + val result = consumer.finalize() element = result return result } - abstract fun render(consumer: HtmlBuilder): HTMLElement + abstract fun HtmlBuilder.render() open fun style(className: String, vararg imports: CssStyle, block: CSSStyleDeclaration.() -> Unit = {}) { val style = (document.createElement("div") as HTMLDivElement).style