Skip to content

Commit 274316c

Browse files
authored
Update README for RxKotlin 1.0 RC
1 parent 0162b29 commit 274316c

File tree

1 file changed

+36
-22
lines changed

1 file changed

+36
-22
lines changed

README.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
1-
# Kotlin Adaptor for RxJava
1+
# RxKotlin
2+
3+
## Kotlin Extensions for RxJava
4+
5+
RxKotlin is a lightweight library that adds convenient extension functions to [RxJava](https://github.com/ReactiveX/RxJava). You can use RxJava with Kotlin out-of-the-box, but Kotlin has language features (such as [extension functions](https://kotlinlang.org/docs/reference/extensions.html)) that can streamline usage of RxJava even more. RxKotlin aims to conservatively collect these conveniences in one centralized library.
26

3-
This adaptor exposes a set of Extension functions that allow a more idiomatic Kotlin usage
47

58
```kotlin
6-
observable<String> { subscriber ->
7-
subscriber.onNext("H")
8-
subscriber.onNext("e")
9-
subscriber.onNext("l")
10-
subscriber.onNext("")
11-
subscriber.onNext("l")
12-
subscriber.onNext("o")
13-
subscriber.onCompleted()
14-
}.filter { it.isNotEmpty() }
15-
.fold (StringBuilder()) { sb, e -> sb.append(e) }
16-
.map { it.toString() }
17-
.subscribe { a.received(it) }
18-
19-
verify(a, times(1)).received("Hello")
9+
package rx.lang.kotlin
10+
11+
import rx.Observable
12+
13+
fun main(args: Array<String>) {
14+
15+
val list = listOf("Alpha", "Beta", "Gamma", "Delta", "Epsilon")
16+
17+
list.toObservable() // extension function for Iterables
18+
.filter { it.length >= 5 }
19+
.subscribeBy( // named arguments for lambda Subscribers
20+
onNext = { println(it) },
21+
onError = { it.printStackTrace() },
22+
onCompleted = { println("Done!") }
23+
)
24+
25+
}
2026
```
2127

28+
## Kotlin Slack Channel
29+
30+
Join us on the #rx channel in Kotlin Slack!
31+
32+
https://kotlinlang.slack.com/messages/rx
33+
34+
2235
## Build
2336

2437
[![Build Status](https://travis-ci.org/ReactiveX/RxKotlin.svg?branch=0.x)](https://travis-ci.org/ReactiveX/RxKotlin)
@@ -37,14 +50,15 @@ Example for Maven:
3750
</dependency>
3851
```
3952

40-
and for Ivy:
41-
42-
```xml
43-
<dependency org="io.reactivex" name="rxkotlin" rev="x.y.z" />
44-
```
45-
4653
and for Gradle:
4754

4855
```groovy
4956
compile 'io.reactivex:rxkotlin:x.y.z'
5057
```
58+
59+
## Contributing
60+
61+
We welcome contributions and discussion for new features. It is recommended to file an issue first to prevent unnecessary efforts, but feel free to put in pull requests. The vision is to keep this library lightweight, with a tight and focused scope applicable to all platforms (including Android, server, and desktop). Anything specific to a particular domain (for example, [JavaFX](https://github.com/thomasnield/RxKotlinFX), [Math](https://github.com/thomasnield/rxkotlin-math), or [JDBC](https://github.com/davidmoten/rxjava-jdbc)) might be better suited as a separate project. Feel free to open discussion and we will help figure out where your functionality may belong.
62+
63+
64+

0 commit comments

Comments
 (0)