Skip to content

Commit 8d4bba6

Browse files
Add cautionary notes to the documentation of JSObject.transfer().
1 parent f0bd60c commit 8d4bba6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Sources/JavaScriptEventLoop/JSObject+Transferring.swift

+3-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,9 @@ extension JSObject {
9797

9898
/// Transfers the ownership of a `JSObject` to be sent to another thread.
9999
///
100-
/// Note that the original ``JSObject`` should not be accessed after calling this method.
100+
/// - Precondition: The thread calling this method should have the ownership of the `JSObject`.
101+
/// - Postcondition: The original `JSObject` is no longer owned by the thread, further access to it
102+
/// on the thread that called this method is invalid and will result in undefined behavior.
101103
///
102104
/// - Parameter object: The ``JSObject`` to be transferred.
103105
/// - Returns: A ``Transferring`` instance that can be shared across threads.

0 commit comments

Comments
 (0)