From a625da07a3c884fcec108e8531d759383fbae034 Mon Sep 17 00:00:00 2001 From: Ian Clarke Date: Sat, 4 Mar 2017 21:50:36 -0600 Subject: [PATCH] bump coroutines lib version --- build.gradle | 6 ++-- docs/index.md | 79 ++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 81 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 31e4af88f7..4d0edd02f4 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ group 'com.github.sanity' -version '0.0.27' +version '0.0.29' buildscript { ext.kotlin_version = '1.1.0' @@ -70,8 +70,8 @@ dependencies { compile group: 'commons-io', name: 'commons-io', version: '2.5' compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.10-rc' - compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:0.10-rc' + compile 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.12' + compile 'org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:0.12' compile 'io.github.microutils:kotlin-logging:1.4.2' diff --git a/docs/index.md b/docs/index.md index 1b079e9810..c7ebdcc8d5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -26,4 +26,81 @@ asynchronicity largely invisible to the programmer. #### What does it look like? -Check out the included [demos](https://github.com/sanity/kweb/tree/master/src/main/kotlin/com/github/sanity/kweb/demos). \ No newline at end of file +Here we create a simple "todo" list app, note this is heavily commented, excluding comments it is +fewer than 40 lines of code. + +```kotlin +import com.github.sanity.kweb.KWeb +import com.github.sanity.kweb.dom.element.creation.* +import com.github.sanity.kweb.dom.element.events.on +import com.github.sanity.kweb.dom.element.modification.addText +import com.github.sanity.kweb.dom.element.modification.delete +import kotlinx.coroutines.experimental.future.await +import kotlinx.coroutines.experimental.future.future + +fun main(args: Array) { + // Starts a web server listening on port 8091 + KWeb(8091, debug = true) { + doc.body.apply { + // Add a header parent to the body, along with some simple instructions. + h1().addText("Simple KWeb demo - a to-do list") + p().addText("Edit the text box below and click the button to add the item. Click an item to remove it.") + + // If you're unfamiliar with the `apply` function, read this: + // http://beust.com/weblog/2015/10/30/exploring-the-kotlin-standard-library/ + + // We create a