diff --git a/doc/api/util.md b/doc/api/util.md index b7801929fa5f5e..d0e134f935d2e1 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -1597,6 +1597,37 @@ Returns the `string` after replacing any surrogate code points (or equivalently, any unpaired surrogate code units) with the Unicode "replacement character" U+FFFD. +## `util.transferableAbortController()` + + + +> Stability: 1 - Experimental + +Creates and returns an {AbortController} instance whose {AbortSignal} is marked +as transferable and can be used with `structuredClone()` or `postMessage()`. + +## `util.transferableAbortSignal(signal)` + + + +> Stability: 1 - Experimental + +* `signal` {AbortSignal} +* Returns: {AbortSignal} + +Marks the given {AbortSignal} as transferable so that it can be used with +`structuredClone()` and `postMessage()`. + +```js +const signal = transferableAbortSignal(AbortSignal.timeout(100)); +const channel = new MessageChannel(); +channel.port2.postMessage(signal, [signal]); +``` + ## `util.types`