@@ -11,6 +11,7 @@ extension JSObject {
1111 ///
1212 /// ``JSObject`` itself is not `Sendable`, but ``Transferring`` is `Sendable` because it's
1313 /// intended to be shared across threads.
14+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
1415 public struct Transferring : @unchecked Sendable {
1516 fileprivate struct CriticalState {
1617 var continuation : CheckedContinuation < JavaScriptObjectRef , Error > ?
@@ -70,6 +71,7 @@ extension JSObject {
7071 /// let canvas = try await transferring.receive()
7172 /// }
7273 /// ```
74+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
7375 public func receive( isolation: isolated ( any Actor ) ? = #isolation, file: StaticString = #file, line: UInt = #line) async throws -> JSObject {
7476 #if compiler(>=6.1) && _runtime(_multithreaded)
7577 swjs_request_transferring_object (
@@ -99,6 +101,7 @@ extension JSObject {
99101 ///
100102 /// - Parameter object: The ``JSObject`` to be transferred.
101103 /// - Returns: A ``Transferring`` instance that can be shared across threads.
104+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
102105 public static func transfer( _ object: JSObject ) -> Transferring {
103106 return Transferring ( sourceObject: object)
104107 }
@@ -115,6 +118,7 @@ extension JSObject {
115118@_expose ( wasm, " swjs_receive_object " )
116119@_cdecl ( " swjs_receive_object " )
117120#endif
121+ @available ( macOS 10 . 15 , iOS 13 . 0 , watchOS 6 . 0 , tvOS 13 . 0 , * )
118122func _swjs_receive_object( _ object: JavaScriptObjectRef , _ transferring: UnsafeRawPointer ) {
119123 #if compiler(>=6.1) && _runtime(_multithreaded)
120124 let storage = Unmanaged < JSObject . Transferring . Storage > . fromOpaque ( transferring) . takeRetainedValue ( )
0 commit comments