Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit 85d8186

Browse files
committed
flesh out todo, move to separate file
1 parent b050f4d commit 85d8186

File tree

10 files changed

+97
-6232
lines changed

10 files changed

+97
-6232
lines changed

README.md

+22-38
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,30 @@
1-
# KWeb
1+
### KWeb, an experimental Kotlin framework for building rich interactive web applications in pure Kotlin
22

3-
## Overview
3+
The idea behind KWeb is to treat the web browser as a fairly dumb robot, keeping most of the intelligence server-side,
4+
relaying instructions to the client via a websocket, and receiving responses from the client. KWeb takes advantage
5+
of the new coroutines functionality in the upcoming Kotlin 1.1 to handle asynchronously waiting for responses
6+
from the client in a way that's almost transparent to the user of KWeb.
47

8+
#### Status - 2017-01-08
9+
KWeb is currently very experimental, at this stage more of a proof-of-concept and playground for ideas than anything
10+
even close to being useful in production.
511

12+
#### Getting started
13+
1. Ensure you are using the "Early Access Preview 1.1" Kotlin plugin in IDEA, see "How to Try It" section at the
14+
bottom of JetBrain's [announcement](https://blog.jetbrains.com/kotlin/2016/12/kotlin-1-1-m04-is-here/).
15+
2. Clone the repository and open as a Gradle project in IntelliJ IDEA: `git@github.com:sanity/kweb.git`
616

7-
## Features
17+
#### An introductory demo
818

9-
## Usage
19+
A very simple implementation of the old-perennial: the to-do list. Allows you to add items to a list, and remove
20+
them by clicking on them.
1021

11-
### Adding library dependency
22+
This makes use of the very useful apply() function, if you're unfamiliar with it I recommend you read
23+
[Exploring the Kotlin Standard Library](http://beust.com/weblog/2015/10/30/exploring-the-kotlin-standard-library/).
1224

13-
You can use this library by adding a dependency for Gradle, Maven, SBT, Leiningen or another Maven-compatible dependency management system thanks to Jitpack:
25+
Take a look at [the code](https://github.com/sanity/kweb/blob/master/src/main/kotlin/com/github/sanity/kweb/demos/todo/todo.kt).
1426

15-
[![](https://jitpack.io/v/sanity/kweb.svg)](https://jitpack.io/#sanity/kweb)
16-
17-
### Basic usage from Kotlin
18-
19-
```kotlin
20-
import com.github.sanity.kweb.clientConduits.WebsocketsClientConduit
21-
import kotlinx.coroutines.async
22-
import kotlin.concurrent.thread
23-
24-
fun main(args: Array<String>) {
25-
WebsocketsClientConduit(8091) {
26-
thread {
27-
async {
28-
var clicks = 0
29-
val heading = doc.body.new("h1")
30-
heading.setInnerHTML("0 clicks")
31-
heading.addEventListener("click") {
32-
clicks++
33-
heading.setInnerHTML("$clicks clicks")
34-
false
35-
}
36-
}
37-
}
38-
false
39-
}
40-
Thread.sleep(10000)
41-
}
42-
43-
```
44-
45-
### License
46-
Released under the [LGPL](https://en.wikipedia.org/wiki/GNU_Lesser_General_Public_License) version 3 by [Ian Clarke](http://blog.locut.us/) of [Stacks](http://trystacks.com/).
27+
##### Try it
28+
1. Take a look at `src/main/kotlin/com/github/sanity/kweb/demos/todo/todo.kt` in IDEA
29+
2. Run it
30+
3. Visit [http://127.0.0.1:8091/](http://127.0.0.1:8091/) in your browser.

docs/pav-example.png

-44.4 KB
Binary file not shown.

docs/pitest-example/Comparisons.kt.html

-103
This file was deleted.

0 commit comments

Comments
 (0)