-
-
Notifications
You must be signed in to change notification settings - Fork 534
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: transfer response buffer on safari (#1771)
- Loading branch information
1 parent
b028c66
commit 6405bea
Showing
4 changed files
with
51 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/** | ||
* Returns a boolean indicating whether the current browser | ||
* supports `ReadableStream` as a `Transferable` when posting | ||
* messages. | ||
*/ | ||
export function supportsReadableStreamTransfer() { | ||
try { | ||
const stream = new ReadableStream({ | ||
start: (controller) => controller.close(), | ||
}) | ||
const message = new MessageChannel() | ||
message.port1.postMessage(stream, [stream]) | ||
return true | ||
} catch (error) { | ||
return false | ||
} | ||
} |