You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update top-level readmes with better example and js + native links
* Provide a better "getting started" example without GlobalScope
* Restore lost information on how to use coroutines with JS and Native
* Update link to the guide (point it to kotlinlang.org version that has
runnable code snippets).
Copy file name to clipboardExpand all lines: README.md
+39-8
Original file line number
Diff line number
Diff line change
@@ -8,12 +8,17 @@ Library support for Kotlin coroutines with [multiplatform](#multiplatform) suppo
8
8
This is a companion version for Kotlin `1.3.30` release.
9
9
10
10
```kotlin
11
-
GlobalScope.launch {
12
-
delay(1000)
13
-
println("Hello from Kotlin Coroutines!")
11
+
suspendfunmain() = coroutineScope {
12
+
launch {
13
+
delay(1000)
14
+
println("Kotlin Coroutines World!")
15
+
}
16
+
println("Hello")
14
17
}
15
18
```
16
19
20
+
> Play with coroutines online [here](https://pl.kotl.in/hG_tKbid_)
21
+
17
22
## Modules
18
23
19
24
*[core](kotlinx-coroutines-core/README.md)— common coroutines across all platforms:
@@ -52,7 +57,7 @@ GlobalScope.launch {
52
57
*[Deep dive into Coroutines](https://www.youtube.com/watch?v=YrrUCSi72E8) (Roman Elizarov at KotlinConf 2017, [slides](https://www.slideshare.net/elizarov/deep-dive-into-coroutines-on-jvm-kotlinconf-2017))
53
58
*[Kotlin Coroutines in Practice](https://www.youtube.com/watch?v=a3agLJQ6vt8) (Roman Elizarov at KotlinConf 2018, [slides](https://www.slideshare.net/elizarov/kotlin-coroutines-in-practice-kotlinconf-2018))
54
59
* Guides and manuals:
55
-
*[Guide to kotlinx.coroutines by example](docs/coroutines-guide.md) (**read it first**)
60
+
*[Guide to kotlinx.coroutines by example](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html) (**read it first**)
56
61
*[Guide to UI programming with coroutines](ui/coroutines-guide-ui.md)
57
62
*[Guide to reactive streams with coroutines](reactive/coroutines-guide-reactive.md)
58
63
*[Debugging capabilities in kotlinx.coroutines](docs/debugging.md)
@@ -136,10 +141,10 @@ Make sure that you have either `jcenter()` or `mavenCentral()` in the list of re
136
141
### Multiplatform
137
142
138
143
Core modules of `kotlinx.coroutines` are also available for
139
-
[Kotlin/JS](js/README.md) and [Kotlin/Native](native/README.md). If you write
140
-
a common code that should get compiled for different platforms, add
This gives you access to Android [Dispatchers.Main](https://kotlin.github.io/kotlinx.coroutines/kotlinx-coroutines-android/kotlinx.coroutines.android/kotlinx.coroutines.-dispatchers/index.html)
153
159
coroutine dispatcher and also makes sure that in case of crashed coroutine with unhandled exception this
154
160
exception is logged before crashing Android application, similarly to the way uncaught exceptions in
@@ -162,6 +168,31 @@ For Proguard you need to add options from [coroutines.pro](kotlinx-coroutines-c
162
168
163
169
R8 is a replacement for ProGuard in Android ecosystem, it is enabled by default since Android gradle plugin 3.3.0-beta.
164
170
171
+
### JS
172
+
173
+
[Kotlin/JS](https://kotlinlang.org/docs/reference/js-overview.html) version of `kotlinx.coroutines` is published as
*[Guide to kotlinx.coroutines by example on JVM](https://github.com/Kotlin/kotlinx.coroutines/blob/master/coroutines-guide.md) (**read it first**)
18
+
*[Guide to kotlinx.coroutines by example on JVM](https://kotlinlang.org/docs/reference/coroutines/coroutines-guide.html) (**read it first**)
16
19
*[Full kotlinx.coroutines API reference](https://kotlin.github.io/kotlinx.coroutines)
0 commit comments