@@ -79,6 +79,7 @@ public struct JSSending<T>: @unchecked Sendable {
7979 }
8080}
8181
82+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
8283extension JSSending where T == JSObject {
8384 private init ( _ object: JSObject , transferring: Bool ) {
8485 self . init (
@@ -165,6 +166,7 @@ extension JSSending where T == JSObject {
165166 }
166167}
167168
169+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
168170extension JSSending {
169171
170172 /// Receives a sent `JSObject` from a thread.
@@ -257,10 +259,12 @@ extension JSSending {
257259 /// - isolation: The actor isolation context for this call, used in Swift concurrency.
258260 /// - Returns: A tuple containing the received objects.
259261 /// - Throws: `JSSendingError` if any sending operation fails, or `JSException` if a JavaScript error occurs.
262+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
260263 public static func receive< each U > (
261264 _ sendings: repeat JSSending < each U > ,
262265 isolation: isolated ( any Actor ) ? = #isolation, file: StaticString = #file, line: UInt = #line
263266 ) async throws -> ( repeat each U ) where T == ( repeat each U ) {
267+ #if compiler(>=6.1) && _runtime(_multithreaded)
264268 var sendingObjects : [ JavaScriptObjectRef ] = [ ]
265269 var transferringObjects : [ JavaScriptObjectRef ] = [ ]
266270 var sourceTid : Int32 ?
@@ -302,9 +306,13 @@ extension JSSending {
302306 return sending. storage. construct ( result. object!)
303307 }
304308 return ( repeat extract( each sendings) )
309+ #else
310+ return ( repeat each sendings. receive ( ) )
311+ #endif
305312 }
306313}
307314
315+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
308316fileprivate final class _JSSendingContext : Sendable {
309317 let continuation : CheckedContinuation < JavaScriptObjectRef , Error >
310318
0 commit comments