Skip to content

Commit 0316e6c

Browse files
committed
Add duplex property for the Fetch API's Request type
1 parent 4cc245f commit 0316e6c

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed

api-reports/2_12.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16510,6 +16510,7 @@ Request[JC] def bodyUsed: Boolean
1651016510
Request[JC] def cache: RequestCache
1651116511
Request[JC] def credentials: RequestCredentials
1651216512
Request[JC] def destination: RequestDestination
16513+
Request[JC] def duplex: RequestDuplex
1651316514
Request[JC] def formData(): js.Promise[FormData]
1651416515
Request[JC] def headers: Headers
1651516516
Request[JC] def integrity: String
@@ -16542,6 +16543,8 @@ RequestDestination[SO] val sharedworker: RequestDestination
1654216543
RequestDestination[SO] val subresource: RequestDestination
1654316544
RequestDestination[SO] val unknown: RequestDestination
1654416545
RequestDestination[SO] val worker: RequestDestination
16546+
RequestDuplex[JT]
16547+
RequestDuplex[SO] val half: RequestDuplex
1654516548
RequestInit[JT] var body: js.UndefOr[BodyInit]
1654616549
RequestInit[JT] var cache: js.UndefOr[RequestCache]
1654716550
RequestInit[JT] var credentials: js.UndefOr[RequestCredentials]

api-reports/2_13.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16510,6 +16510,7 @@ Request[JC] def bodyUsed: Boolean
1651016510
Request[JC] def cache: RequestCache
1651116511
Request[JC] def credentials: RequestCredentials
1651216512
Request[JC] def destination: RequestDestination
16513+
Request[JC] def duplex: RequestDuplex
1651316514
Request[JC] def formData(): js.Promise[FormData]
1651416515
Request[JC] def headers: Headers
1651516516
Request[JC] def integrity: String
@@ -16542,6 +16543,8 @@ RequestDestination[SO] val sharedworker: RequestDestination
1654216543
RequestDestination[SO] val subresource: RequestDestination
1654316544
RequestDestination[SO] val unknown: RequestDestination
1654416545
RequestDestination[SO] val worker: RequestDestination
16546+
RequestDuplex[JT]
16547+
RequestDuplex[SO] val half: RequestDuplex
1654516548
RequestInit[JT] var body: js.UndefOr[BodyInit]
1654616549
RequestInit[JT] var cache: js.UndefOr[RequestCache]
1654716550
RequestInit[JT] var credentials: js.UndefOr[RequestCredentials]
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
/**
6+
* Fetch APIs [[https://fetch.spec.whatwg.org/#dom-requestinit-duplex RequestDuplex enum]]
7+
*/
8+
@js.native
9+
sealed trait RequestDuplex extends js.Any
10+
11+
object RequestDuplex {
12+
val half: RequestDuplex = "half".asInstanceOf[RequestDuplex]
13+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package org.scalajs.dom
2+
3+
import scala.scalajs.js
4+
5+
/**
6+
* Fetch APIs [[https://fetch.spec.whatwg.org/#dom-requestinit-duplex RequestDuplex enum]]
7+
*/
8+
opaque type RequestDuplex <: String = String
9+
10+
object RequestDuplex {
11+
val half: RequestDuplex = "half"
12+
}

dom/src/main/scala/org/scalajs/dom/Request.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,9 @@ class Request(input: RequestInfo, init: RequestInit = null) extends Body {
4747
def keepalive: Boolean = js.native
4848

4949
def signal: AbortSignal = js.native
50+
51+
/** "half" is the only valid value and it is for initiating a half-duplex fetch (i.e., the user agent sends the entire
52+
* request before processing the response).
53+
*/
54+
def duplex: RequestDuplex = js.native
5055
}

0 commit comments

Comments
 (0)