File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -5,3 +5,4 @@ This is the example from my [blog post with the same title](https://domnikl.gith
5
5
- [ Step 0] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step0/src/main/kotlin/Main.kt )
6
6
- [ Step 1] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step1/src/main/kotlin/Main.kt )
7
7
- [ Step 2] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step2/src/main/kotlin/Main.kt )
8
+ - [ Step 3] ( https://github.com/domnikl/kotlin-coroutines-and-javafx-threads/blob/step3/src/main/kotlin/Main.kt )
Original file line number Diff line number Diff line change @@ -8,9 +8,12 @@ import kotlinx.coroutines.*
8
8
import kotlinx.coroutines.javafx.JavaFx
9
9
import kotlin.coroutines.CoroutineContext
10
10
11
- class MillisElapsedCounter (private val observer : Observer ) {
11
+ class MillisElapsedCounter (private val observer : Observer ) : CoroutineScope {
12
+ override val coroutineContext: CoroutineContext
13
+ get() = Dispatchers .Default
14
+
12
15
fun start () {
13
- GlobalScope . launch( Dispatchers . Default ) {
16
+ launch {
14
17
var millisElapsed = 0
15
18
16
19
while (true ) {
You can’t perform that action at this time.
0 commit comments