diff --git a/.space.kts b/.space.kts deleted file mode 100644 index 45b2ed53..00000000 --- a/.space.kts +++ /dev/null @@ -1,4 +0,0 @@ -job("Build") { - gradlew("openjdk:11", "build") -} - diff --git a/demo/playground/src/jvmMain/kotlin/controlVision.kt b/demo/playground/src/jvmMain/kotlin/controlVision.kt index f7a9c753..5cd1c2d2 100644 --- a/demo/playground/src/jvmMain/kotlin/controlVision.kt +++ b/demo/playground/src/jvmMain/kotlin/controlVision.kt @@ -1,9 +1,14 @@ package space.kscience.visionforge.examples +import kotlinx.coroutines.delay +import kotlinx.coroutines.isActive +import kotlinx.coroutines.launch +import kotlinx.html.h2 import kotlinx.html.p import space.kscience.visionforge.VisionControlEvent import space.kscience.visionforge.html.* import space.kscience.visionforge.onClick +import kotlin.time.Duration.Companion.seconds fun main() = serve { @@ -25,6 +30,7 @@ fun main() = serve { } } } + h2 { +"Control elements" } vision { htmlCheckBox { @@ -41,13 +47,19 @@ fun main() = serve { onValueChange(context) { pushEvent(this) } + context.launch { + while (isActive) { + delay(1.seconds) + numberValue = ((numberValue?.toInt() ?: 0) + 1) % 10 + } + } } } vision { - button("Click me"){ - onClick(context){ + button("Click me") { + onClick(context) { pushEvent(this) } } diff --git a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/html/VisionOfHtml.kt b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/html/VisionOfHtml.kt index 2bd7b9de..b496cf07 100644 --- a/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/html/VisionOfHtml.kt +++ b/visionforge-core/src/commonMain/kotlin/space/kscience/visionforge/html/VisionOfHtml.kt @@ -18,7 +18,7 @@ import space.kscience.visionforge.* @Serializable public abstract class VisionOfHtml : AbstractVision() { public var classes: Set - get() = properties.get(::classes.name,false).stringList?.toSet() ?: emptySet() + get() = properties[::classes.name, false].stringList?.toSet() ?: emptySet() set(value) { properties[::classes.name] = value.map { it.asValue() } }