Corrections to the Guide to UI programming with coroutines (mostly typos)
diff --git a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-01.kt b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-01.kt
index 58255ac..b1def37 100644
--- a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-01.kt
+++ b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-01.kt
@@ -72,10 +72,10 @@
}
}
-fun Node.onClick(block: suspend (MouseEvent) -> Unit) {
+fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
onMouseClicked = EventHandler { event ->
launch(UI) {
- block(event)
+ action(event)
}
}
}
diff --git a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-02.kt b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-02.kt
index 906b57a..eaa8bf9 100644
--- a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-02.kt
+++ b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-02.kt
@@ -72,10 +72,10 @@
}
}
-fun Node.onClick(block: suspend (MouseEvent) -> Unit) {
+fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
// launch one actor to handle all events on this node
val eventActor = actor<MouseEvent>(UI) {
- for (event in channel) block(event) // pass event to block
+ for (event in channel) action(event) // pass event to action
}
// install a listener to offer events to this actor
onMouseClicked = EventHandler { event ->
diff --git a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-03.kt b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-03.kt
index 7ef31f2..9dde39f 100644
--- a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-03.kt
+++ b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-actor-03.kt
@@ -72,10 +72,10 @@
}
}
-fun Node.onClick(block: suspend (MouseEvent) -> Unit) {
+fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
// launch one actor to handle all events on this node
val eventActor = actor<MouseEvent>(UI, capacity = Channel.CONFLATED) { // <--- Changed here
- for (event in channel) block(event) // pass event to block
+ for (event in channel) action(event) // pass event to action
}
// install a listener to offer events to this actor
onMouseClicked = EventHandler { event ->
diff --git a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-01.kt b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-01.kt
index 3ceaecb..a0036cd 100644
--- a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-01.kt
+++ b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-01.kt
@@ -62,9 +62,9 @@
}
}
-fun Node.onClick(block: suspend (MouseEvent) -> Unit) {
+fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
val eventActor = actor<MouseEvent>(UI, capacity = Channel.CONFLATED) {
- for (event in channel) block(event) // pass event to block
+ for (event in channel) action(event) // pass event to action
}
onMouseClicked = EventHandler { event ->
eventActor.offer(event)
@@ -84,7 +84,7 @@
delay(100) // update the text every 100ms
}
}
- // compute next fibonacci number of each click
+ // compute the next fibonacci number of each click
var x = 1
fab.onClick {
result = "fib($x) = ${fib(x)}"
diff --git a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-02.kt b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-02.kt
index ac24f0a..62cd354 100644
--- a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-02.kt
+++ b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-02.kt
@@ -62,9 +62,9 @@
}
}
-fun Node.onClick(block: suspend (MouseEvent) -> Unit) {
+fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
val eventActor = actor<MouseEvent>(UI, capacity = Channel.CONFLATED) {
- for (event in channel) block(event) // pass event to block
+ for (event in channel) action(event) // pass event to action
}
onMouseClicked = EventHandler { event ->
eventActor.offer(event)
diff --git a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-03.kt b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-03.kt
index de041ee..01deb6f 100644
--- a/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-03.kt
+++ b/ui/kotlinx-coroutines-javafx/src/test/kotlin/guide/example-ui-blocking-03.kt
@@ -62,9 +62,9 @@
}
}
-fun Node.onClick(block: suspend (MouseEvent) -> Unit) {
+fun Node.onClick(action: suspend (MouseEvent) -> Unit) {
val eventActor = actor<MouseEvent>(UI, capacity = Channel.CONFLATED) {
- for (event in channel) block(event) // pass event to block
+ for (event in channel) action(event) // pass event to action
}
onMouseClicked = EventHandler { event ->
eventActor.offer(event)