@@ -34,22 +34,22 @@ public sealed class JavaFxDispatcher : MainCoroutineDispatcher(), Delay {
34
34
35
35
/* * @suppress */
36
36
override fun scheduleResumeAfterDelay (timeMillis : Long , continuation : CancellableContinuation <Unit >) {
37
- val timeline = schedule(timeMillis, TimeUnit . MILLISECONDS ) {
37
+ val timeline = schedule(timeMillis) {
38
38
with (continuation) { resumeUndispatched(Unit ) }
39
39
}
40
40
continuation.invokeOnCancellation { timeline.stop() }
41
41
}
42
42
43
43
/* * @suppress */
44
44
override fun invokeOnTimeout (timeMillis : Long , block : Runnable , context : CoroutineContext ): DisposableHandle {
45
- val timeline = schedule(timeMillis, TimeUnit . MILLISECONDS ) {
45
+ val timeline = schedule(timeMillis) {
46
46
block.run ()
47
47
}
48
48
return DisposableHandle { timeline.stop() }
49
49
}
50
50
51
- private fun schedule (time : Long , unit : TimeUnit , handler : EventHandler <ActionEvent >): Timeline =
52
- Timeline (KeyFrame (Duration .millis(unit.toMillis(time) .toDouble()), handler)).apply { play() }
51
+ private fun schedule (timeMillis : Long , handler : EventHandler <ActionEvent >): Timeline =
52
+ Timeline (KeyFrame (Duration .millis(timeMillis .toDouble()), handler)).apply { play() }
53
53
}
54
54
55
55
internal class JavaFxDispatcherFactory : MainDispatcherFactory {
@@ -97,7 +97,7 @@ public suspend fun awaitPulse(): Long = suspendCancellableCoroutine { cont ->
97
97
}
98
98
99
99
private class PulseTimer : AnimationTimer () {
100
- val next = CopyOnWriteArrayList <CancellableContinuation <Long >>()
100
+ private val next = CopyOnWriteArrayList <CancellableContinuation <Long >>()
101
101
102
102
override fun handle (now : Long ) {
103
103
val cur = next.toTypedArray()
@@ -116,6 +116,7 @@ internal fun initPlatform(): Boolean = PlatformInitializer.success
116
116
117
117
// Lazily try to initialize JavaFx platform just once
118
118
private object PlatformInitializer {
119
+ @JvmField
119
120
val success = run {
120
121
/*
121
122
* Try to instantiate JavaFx platform in a way which works
0 commit comments