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