@@ -2,51 +2,136 @@ package org.scalajs.dom
2
2
3
3
import org .scalajs .dom
4
4
import scala .scalajs .js
5
- import scala .scalajs .js .|
5
+ import scala .scalajs .js .annotation . _
6
6
7
7
package object experimental {
8
8
9
- /**
10
- * defined at [[https://fetch.spec.whatwg.org/#request-class ¶6.3 Request class ]]
11
- * of whatwg Fetch spec
12
- */
13
- type RequestInfo = String | Request
14
-
15
- /**
16
- * defined at [[https://fetch.spec.whatwg.org/#headersinit ¶6.1 Header Class ]]
17
- * in whatwg Fetch spec
18
- * todo: it should be OpenEndedDictionary[ByteString]
19
- */
20
- type HeadersInit =
21
- Headers | Sequence [Sequence [ByteString ]] | OpenEndedDictionary [ByteString ]
22
-
23
- /**
24
- * This type should capture strings consisting only of ASCII chars
25
- * todo: is there a way to capture this type?
26
- */
27
- type ByteString = String
28
-
29
- /**
30
- * defined at [[https://fetch.spec.whatwg.org/#body-mixin ¶6.2 Body mixin ]]
31
- * in whatwg Fetch spec
32
- */
33
- type BodyInit =
34
- Blob | BufferSource | FormData | String // todo: add URLSearchParams
35
-
36
- /**
37
- * WebIDL sequence<T> is js.Array[T] | JSIterable[T]. However @mseddon knows
38
- * at least Blink's IDL compiler treats these as simply js.Array[T] for now.
39
- * We keep this type as a reminder to check in more detail
40
- */
41
- type Sequence [T ] = js.Array [T ]
42
-
43
- /**
44
- * see [[https://fetch.spec.whatwg.org/#headers-class ¶6.1 Headers class ]] in
45
- * whatwg Fetch spec.
46
- * also see: [[https://github.com/whatwg/fetch/issues/164 issue 164 ]] in Fetch
47
- * API git repo, as this is not clearly defined
48
- */
49
- type OpenEndedDictionary [T ] = js.Dictionary [T ]
9
+ // old package.scala
10
+
11
+ @ deprecated(" use dom.RequestInfo instead" , " 2.0.0" )
12
+ type RequestInfo = dom.RequestInfo
13
+
14
+ @ deprecated(" use dom.HeadersInit instead" , " 2.0.0" )
15
+ type HeadersInit = dom.HeadersInit
16
+
17
+ @ deprecated(" use dom.ByteString instead" , " 2.0.0" )
18
+ type ByteString = dom.ByteString
19
+
20
+ @ deprecated(" use dom.BodyInit instead" , " 2.0.0" )
21
+ type BodyInit = dom.BodyInit
22
+
23
+ @ deprecated(" use dom.Sequence instead" , " 2.0.0" )
24
+ type Sequence [T ] = dom.Sequence [T ]
25
+
26
+ @ deprecated(" use dom.OpenEndedDictionary instead" , " 2.0.0" )
27
+ type OpenEndedDictionary [T ] = dom.OpenEndedDictionary [T ]
28
+
29
+ // old AbortController.scala
30
+
31
+ @ deprecated(" use dom.AbortController instead" , " 2.0.0" )
32
+ type AbortController = dom.AbortController
33
+
34
+ @ deprecated(" use dom.AbortSignal instead" , " 2.0.0" )
35
+ type AbortSignal = dom.AbortSignal
36
+
37
+ // old Fetch.scala
38
+
39
+ @ deprecated(" use dom.fetch instead" , " 2.0.0" )
40
+ object Fetch {
41
+ @ js.native
42
+ @ JSGlobal (" fetch" )
43
+ def fetch (info : RequestInfo ,
44
+ init : RequestInit = null ): js.Promise [Response ] = js.native
45
+ }
46
+
47
+ @ deprecated(" use dom.Request instead" , " 2.0.0" )
48
+ type Request = dom.Request
49
+
50
+ @ deprecated(" use dom.RequestInit instead" , " 2.0.0" )
51
+ type RequestInit = dom.RequestInit
52
+
53
+ @ deprecated(" use dom.Response instead" , " 2.0.0" )
54
+ type Response = dom.Response
55
+
56
+ @ deprecated(" use dom.Response instead" , " 2.0.0" )
57
+ lazy val Response : dom.Response .type = dom.Response
58
+
59
+ @ deprecated(" use dom.ResponseInit instead" , " 2.0.0" )
60
+ type ResponseInit = dom.ResponseInit
61
+
62
+ @ deprecated(" use new dom.ResponseInit { ... } instead" , " 2.0.0" )
63
+ object ResponseInit {
64
+ def apply (_status : Int = 200 , _statusText : ByteString = " OK" ,
65
+ _headers : HeadersInit = js.Dictionary [String ]()): ResponseInit = {
66
+ new ResponseInit {
67
+ var status = _status
68
+ var statusText = _statusText
69
+ var headers = _headers
70
+ }
71
+ }
72
+ }
73
+
74
+ @ deprecated(" use dom.Body instead" , " 2.0.0" )
75
+ type Body = dom.Body
76
+
77
+ @ deprecated(" use dom.Headers instead" , " 2.0.0" )
78
+ type Headers = dom.Headers
79
+
80
+ @ deprecated(" use dom.ReferrerPolicy instead" , " 2.0.0" )
81
+ type ReferrerPolicy = dom.ReferrerPolicy
82
+
83
+ @ deprecated(" use dom.ReferrerPolicy instead" , " 2.0.0" )
84
+ lazy val ReferrerPolicy : dom.ReferrerPolicy .type = dom.ReferrerPolicy
85
+
86
+ @ deprecated(" use dom.HttpMethod instead" , " 2.0.0" )
87
+ type HttpMethod = dom.HttpMethod
88
+
89
+ @ deprecated(" use dom.HttpMethod instead" , " 2.0.0" )
90
+ lazy val HttpMethod : dom.HttpMethod .type = dom.HttpMethod
91
+
92
+ @ deprecated(" use dom.RequestType instead" , " 2.0.0" )
93
+ type RequestType = dom.RequestType
94
+
95
+ @ deprecated(" use dom.RequestType instead" , " 2.0.0" )
96
+ lazy val RequestType : dom.RequestType .type = dom.RequestType
97
+
98
+ @ deprecated(" use dom.RequestDestination instead" , " 2.0.0" )
99
+ type RequestDestination = dom.RequestDestination
100
+
101
+ @ deprecated(" use dom.RequestDestination instead" , " 2.0.0" )
102
+ lazy val RequestDestination : dom.RequestDestination .type =
103
+ dom.RequestDestination
104
+
105
+ @ deprecated(" use dom.RequestMode instead" , " 2.0.0" )
106
+ type RequestMode = dom.RequestMode
107
+
108
+ @ deprecated(" use dom.RequestMode instead" , " 2.0.0" )
109
+ lazy val RequestMode : dom.RequestMode .type = dom.RequestMode
110
+
111
+ @ deprecated(" use dom.RequestCredentials instead" , " 2.0.0" )
112
+ type RequestCredentials = dom.RequestCredentials
113
+
114
+ @ deprecated(" use dom.RequestCredentials instead" , " 2.0.0" )
115
+ lazy val RequestCredentials : dom.RequestCredentials .type =
116
+ dom.RequestCredentials
117
+
118
+ @ deprecated(" use dom.RequestCache instead" , " 2.0.0" )
119
+ type RequestCache = dom.RequestCache
120
+
121
+ @ deprecated(" use dom.RequestCache instead" , " 2.0.0" )
122
+ lazy val RequestCache : dom.RequestCache .type = dom.RequestCache
123
+
124
+ @ deprecated(" use dom.RequestRedirect instead" , " 2.0.0" )
125
+ type RequestRedirect = dom.RequestRedirect
126
+
127
+ @ deprecated(" use dom.RequestRedirect instead" , " 2.0.0" )
128
+ lazy val RequestRedirect : dom.RequestRedirect .type = dom.RequestRedirect
129
+
130
+ @ deprecated(" use dom.ResponseType instead" , " 2.0.0" )
131
+ type ResponseType = dom.ResponseType
132
+
133
+ @ deprecated(" use dom.ResponseType instead" , " 2.0.0" )
134
+ lazy val ResponseType : dom.ResponseType .type = dom.ResponseType
50
135
51
136
// old Notification.scala
52
137
@@ -58,4 +143,35 @@ package object experimental {
58
143
59
144
@ deprecated(" use dom.NotificationOptions instead" , " 2.0.0" )
60
145
type NotificationOptions = dom.NotificationOptions
146
+
147
+ // old Stream.scala
148
+
149
+ @ deprecated(" use dom.WriteableState instead" , " 2.0.0" )
150
+ type WriteableState = dom.WriteableState
151
+
152
+ @ deprecated(" use dom.WriteableState instead" , " 2.0.0" )
153
+ lazy val WriteableState : dom.WriteableState .type = dom.WriteableState
154
+
155
+ @ deprecated(" use dom.WriteableStream instead" , " 2.0.0" )
156
+ type WriteableStream [- T ] = dom.WriteableStream [T ]
157
+
158
+ @ deprecated(" use dom.ReadableStream instead" , " 2.0.0" )
159
+ type ReadableStream [+ T ] = dom.ReadableStream [T ]
160
+
161
+ @ deprecated(" use dom.ReadableStreamReader instead" , " 2.0.0" )
162
+ type ReadableStreamReader [+ T ] = dom.ReadableStreamReader [T ]
163
+
164
+ @ deprecated(" use dom.ReadableStreamController instead" , " 2.0.0" )
165
+ type ReadableStreamController [- T ] = dom.ReadableStreamController [T ]
166
+
167
+ @ deprecated(" use dom.Chunk instead" , " 2.0.0" )
168
+ type Chunk [+ T ] = dom.Chunk [T ]
169
+
170
+ // old URL.scala
171
+
172
+ @ deprecated(" use dom.URL instead" , " 2.0.0" )
173
+ type URL = dom.URL
174
+
175
+ @ deprecated(" use dom.URLSearchParams instead" , " 2.0.0" )
176
+ type URLSearchParams = dom.URLSearchParams
61
177
}
0 commit comments