From 9665fe692681bc958e55d00cc0d0b238b7aee694 Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Sat, 3 Feb 2018 23:21:46 +0100 Subject: Refactoring for kdoc API documentation with dokka --- .../src/main/kotlin/com/example/Helloworld.kt | 32 ----------------- .../helloworld/src/main/kotlin/com/example/Main.kt | 42 ---------------------- 2 files changed, 74 deletions(-) delete mode 100644 examples/helloworld/src/main/kotlin/com/example/Helloworld.kt delete mode 100644 examples/helloworld/src/main/kotlin/com/example/Main.kt (limited to 'examples/helloworld/src/main/kotlin') diff --git a/examples/helloworld/src/main/kotlin/com/example/Helloworld.kt b/examples/helloworld/src/main/kotlin/com/example/Helloworld.kt deleted file mode 100644 index 61e75482..00000000 --- a/examples/helloworld/src/main/kotlin/com/example/Helloworld.kt +++ /dev/null @@ -1,32 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.Root -import pl.treksoft.kvision.html.TAG -import pl.treksoft.kvision.html.Tag -import pl.treksoft.kvision.panel.FLEXDIR -import pl.treksoft.kvision.panel.FLEXJUSTIFY -import pl.treksoft.kvision.panel.FlexPanel -import pl.treksoft.kvision.utils.px - -class Helloworld : ApplicationBase() { - - override fun start(state: Map) { - val root = Root("helloworld") - val panel = FlexPanel(FLEXDIR.ROW, justify = FLEXJUSTIFY.CENTER) - val hello = Tag(TAG.DIV, "Hello world!", classes = setOf("helloworld")).apply { - marginTop = 50.px() - - } - panel.add(hello) - root.add(panel) - } - - override fun dispose(): Map { - return mapOf() - } - - companion object { - val css = require("./css/style.css") - } -} diff --git a/examples/helloworld/src/main/kotlin/com/example/Main.kt b/examples/helloworld/src/main/kotlin/com/example/Main.kt deleted file mode 100644 index 53b6b0ae..00000000 --- a/examples/helloworld/src/main/kotlin/com/example/Main.kt +++ /dev/null @@ -1,42 +0,0 @@ -package com.example - -import pl.treksoft.kvision.ApplicationBase -import pl.treksoft.kvision.core.KVManager -import pl.treksoft.kvision.module -import kotlin.browser.document - -external fun require(name: String): dynamic - -fun main(args: Array) { - var application: ApplicationBase? = null - - val state: dynamic = module.hot?.let { hot -> - hot.accept() - - hot.dispose { data -> - data.appState = application?.dispose() - KVManager.shutdown() - application = null - } - - hot.data - } - - if (document.body != null) { - KVManager.start() - application = start(state) - } else { - KVManager.init() - application = null - document.addEventListener("DOMContentLoaded", { application = start(state) }) - } -} - -fun start(state: dynamic): ApplicationBase? { - if (document.getElementById("helloworld") == null) return null - val application = Helloworld() - @Suppress("UnsafeCastFromDynamic") - application.start(state?.appState ?: emptyMap()) - return application -} - -- cgit