File size: 438 Bytes
d4b85c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/**
 * 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 {
    return false
  }
}