@@ -12,15 +12,15 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
12
12
/// See also: https://developer.mozilla.org/en-US/docs/Web/API/HTML_DOM_API/Microtask_guide
13
13
let queueMicrotask : @Sendable ( @escaping ( ) -> Void ) -> Void
14
14
/// A function that invokes a given closure after a specified number of milliseconds.
15
- let setTimeout : @Sendable ( UInt64 , @escaping ( ) -> Void ) -> Void
15
+ let setTimeout : @Sendable ( Double , @escaping ( ) -> Void ) -> Void
16
16
17
17
/// A mutable state to manage internal job queue
18
18
/// Note that this should be guarded atomically when supporting multi-threaded environment.
19
19
var queueState = QueueState ( )
20
20
21
21
private init (
22
22
queueTask: @Sendable @escaping ( @escaping ( ) -> Void ) -> Void ,
23
- setTimeout: @Sendable @escaping ( UInt64 , @escaping ( ) -> Void ) -> Void
23
+ setTimeout: @Sendable @escaping ( Double , @escaping ( ) -> Void ) -> Void
24
24
) {
25
25
self . queueMicrotask = queueTask
26
26
self . setTimeout = setTimeout
@@ -83,7 +83,7 @@ public final class JavaScriptEventLoop: SerialExecutor, @unchecked Sendable {
83
83
84
84
private func enqueue( _ job: UnownedJob , withDelay nanoseconds: UInt64 ) {
85
85
let milliseconds = nanoseconds / 1_000_000
86
- setTimeout ( milliseconds, {
86
+ setTimeout ( Double ( milliseconds) , {
87
87
job. _runSynchronously ( on: self . asUnownedSerialExecutor ( ) )
88
88
} )
89
89
}
0 commit comments