Skip to content

Commit 711dc27

Browse files
committed
Deprecate the ext.Ajax extension.
Recommend to use `dom.fetch` instead, whose API is basically just as good as `Ajax` was.
1 parent c53e928 commit 711dc27

File tree

3 files changed

+32
-24
lines changed

3 files changed

+32
-24
lines changed

api-reports/2_12.txt

+13-12
Original file line numberDiff line numberDiff line change
@@ -24606,24 +24606,25 @@ experimental/webrtc/RTCStatsType[SO] val `outbound-rtp` = "outbound-rtp".asInsta
2460624606
experimental/webrtc/package[SO] def mediaDevices: MediaDevices
2460724607
experimental/webrtc/package[SO] implicit def toWebRTC(n: org.scalajs.dom.Navigator): NavigatorMediaStream
2460824608
experimental/webrtc/package.NavigatorMediaStream[JT] def mediaDevices: MediaDevices
24609-
ext/Ajax[SO] def apply(method: String, url: String, data: InputData, timeout: Int, headers: Map[String, String], withCredentials: Boolean, responseType: String): Future[dom.XMLHttpRequest]
24610-
ext/Ajax[SO] implicit def arrayBufferView2ajax(b: ArrayBufferView): InputData
24611-
ext/Ajax[SO] implicit def blob2ajax(b: Blob): InputData
24612-
ext/Ajax[SO] implicit def byteBuffer2ajax(data: ByteBuffer): InputData
24613-
ext/Ajax[SO] def delete(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("DELETE", url, data, timeout, headers, withCredentials, responseType) }
24614-
ext/Ajax[SO] implicit def formdata2ajax(b: FormData): InputData
24615-
ext/Ajax[SO] def get(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("GET", url, data, timeout, headers, withCredentials, responseType) }
24616-
ext/Ajax[SO] def patch(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PATCH", url, data, timeout, headers, withCredentials, responseType) }
24617-
ext/Ajax[SO] def post(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("POST", url, data, timeout, headers, withCredentials, responseType) }
24618-
ext/Ajax[SO] def put(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PUT", url, data, timeout, headers, withCredentials, responseType) }
24619-
ext/Ajax[SO] implicit def str2ajax(s: String): InputData
24609+
ext/Ajax[SO] def apply(method: String, url: String, data: InputData, timeout: Int, headers: Map[String, String], withCredentials: Boolean, responseType: String): Future[dom.XMLHttpRequest] (@deprecated in 2.0.0)
24610+
ext/Ajax[SO] implicit def arrayBufferView2ajax(b: ArrayBufferView): InputData (@deprecated in 2.0.0)
24611+
ext/Ajax[SO] implicit def blob2ajax(b: Blob): InputData (@deprecated in 2.0.0)
24612+
ext/Ajax[SO] implicit def byteBuffer2ajax(data: ByteBuffer): InputData (@deprecated in 2.0.0)
24613+
ext/Ajax[SO] def delete(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("DELETE", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24614+
ext/Ajax[SO] implicit def formdata2ajax(b: FormData): InputData (@deprecated in 2.0.0)
24615+
ext/Ajax[SO] def get(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("GET", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24616+
ext/Ajax[SO] def patch(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PATCH", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24617+
ext/Ajax[SO] def post(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("POST", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24618+
ext/Ajax[SO] def put(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PUT", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24619+
ext/Ajax[SO] implicit def str2ajax(s: String): InputData (@deprecated in 2.0.0)
2462024620
ext/Ajax.InputData[JT]
2462124621
ext/Ajax.InputData[SO] implicit def arrayBufferView2ajax(b: ArrayBufferView): InputData
2462224622
ext/Ajax.InputData[SO] implicit def blob2ajax(b: Blob): InputData
2462324623
ext/Ajax.InputData[SO] implicit def byteBuffer2ajax(data: ByteBuffer): InputData
2462424624
ext/Ajax.InputData[SO] implicit def formdata2ajax(b: FormData): InputData
2462524625
ext/Ajax.InputData[SO] implicit def str2ajax(s: String): InputData
24626-
ext/AjaxException[SC] def isTimeout = xhr.status = = 0 && xhr.readyState = = 4
24626+
ext/AjaxException[SC] def isTimeout = xhr.status = = 0 && xhr.readyState = = 4 (@deprecated in 2.0.0)
24627+
ext/AjaxException[SO] (@deprecated in 2.0.0)
2462724628
ext/package[SO] val KeyCode: dom.KeyCode.type (@deprecated in 2.0.0)
2462824629
ext/package[SO] val KeyLocation: dom.KeyLocation.type (@deprecated in 2.0.0)
2462924630
ext/package[SO] val KeyValue: dom.KeyValue.type (@deprecated in 2.0.0)

api-reports/2_13.txt

+13-12
Original file line numberDiff line numberDiff line change
@@ -24606,24 +24606,25 @@ experimental/webrtc/RTCStatsType[SO] val `outbound-rtp` = "outbound-rtp".asInsta
2460624606
experimental/webrtc/package[SO] def mediaDevices: MediaDevices
2460724607
experimental/webrtc/package[SO] implicit def toWebRTC(n: org.scalajs.dom.Navigator): NavigatorMediaStream
2460824608
experimental/webrtc/package.NavigatorMediaStream[JT] def mediaDevices: MediaDevices
24609-
ext/Ajax[SO] def apply(method: String, url: String, data: InputData, timeout: Int, headers: Map[String, String], withCredentials: Boolean, responseType: String): Future[dom.XMLHttpRequest]
24610-
ext/Ajax[SO] implicit def arrayBufferView2ajax(b: ArrayBufferView): InputData
24611-
ext/Ajax[SO] implicit def blob2ajax(b: Blob): InputData
24612-
ext/Ajax[SO] implicit def byteBuffer2ajax(data: ByteBuffer): InputData
24613-
ext/Ajax[SO] def delete(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("DELETE", url, data, timeout, headers, withCredentials, responseType) }
24614-
ext/Ajax[SO] implicit def formdata2ajax(b: FormData): InputData
24615-
ext/Ajax[SO] def get(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("GET", url, data, timeout, headers, withCredentials, responseType) }
24616-
ext/Ajax[SO] def patch(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PATCH", url, data, timeout, headers, withCredentials, responseType) }
24617-
ext/Ajax[SO] def post(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("POST", url, data, timeout, headers, withCredentials, responseType) }
24618-
ext/Ajax[SO] def put(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PUT", url, data, timeout, headers, withCredentials, responseType) }
24619-
ext/Ajax[SO] implicit def str2ajax(s: String): InputData
24609+
ext/Ajax[SO] def apply(method: String, url: String, data: InputData, timeout: Int, headers: Map[String, String], withCredentials: Boolean, responseType: String): Future[dom.XMLHttpRequest] (@deprecated in 2.0.0)
24610+
ext/Ajax[SO] implicit def arrayBufferView2ajax(b: ArrayBufferView): InputData (@deprecated in 2.0.0)
24611+
ext/Ajax[SO] implicit def blob2ajax(b: Blob): InputData (@deprecated in 2.0.0)
24612+
ext/Ajax[SO] implicit def byteBuffer2ajax(data: ByteBuffer): InputData (@deprecated in 2.0.0)
24613+
ext/Ajax[SO] def delete(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("DELETE", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24614+
ext/Ajax[SO] implicit def formdata2ajax(b: FormData): InputData (@deprecated in 2.0.0)
24615+
ext/Ajax[SO] def get(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("GET", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24616+
ext/Ajax[SO] def patch(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PATCH", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24617+
ext/Ajax[SO] def post(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("POST", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24618+
ext/Ajax[SO] def put(url: String, data: InputData = null, timeout: Int = 0, headers: Map[String, String] = Map.empty, withCredentials: Boolean = false, responseType: String = "") = { apply("PUT", url, data, timeout, headers, withCredentials, responseType) } (@deprecated in 2.0.0)
24619+
ext/Ajax[SO] implicit def str2ajax(s: String): InputData (@deprecated in 2.0.0)
2462024620
ext/Ajax.InputData[JT]
2462124621
ext/Ajax.InputData[SO] implicit def arrayBufferView2ajax(b: ArrayBufferView): InputData
2462224622
ext/Ajax.InputData[SO] implicit def blob2ajax(b: Blob): InputData
2462324623
ext/Ajax.InputData[SO] implicit def byteBuffer2ajax(data: ByteBuffer): InputData
2462424624
ext/Ajax.InputData[SO] implicit def formdata2ajax(b: FormData): InputData
2462524625
ext/Ajax.InputData[SO] implicit def str2ajax(s: String): InputData
24626-
ext/AjaxException[SC] def isTimeout = xhr.status = = 0 && xhr.readyState = = 4
24626+
ext/AjaxException[SC] def isTimeout = xhr.status = = 0 && xhr.readyState = = 4 (@deprecated in 2.0.0)
24627+
ext/AjaxException[SO] (@deprecated in 2.0.0)
2462724628
ext/package[SO] val KeyCode: dom.KeyCode.type (@deprecated in 2.0.0)
2462824629
ext/package[SO] val KeyLocation: dom.KeyLocation.type (@deprecated in 2.0.0)
2462924630
ext/package[SO] val KeyValue: dom.KeyValue.type (@deprecated in 2.0.0)

src/main/scala/org/scalajs/dom/ext/Extensions.scala

+6
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,20 @@ import scala.scalajs.js.typedarray.TypedArrayBufferOps._
1313
* Thrown when `Ajax.get` or `Ajax.post` receives a non-20X response code.
1414
* Contains the XMLHttpRequest that resulted in that response
1515
*/
16+
@deprecated("use the dom.fetch API instead", "2.0.0")
1617
case class AjaxException(xhr: dom.XMLHttpRequest) extends Exception {
1718
def isTimeout = xhr.status == 0 && xhr.readyState == 4
1819
}
1920

21+
// This is just there to work around some weird warnings in Scala 3.x
22+
@deprecated("use the dom.fetch API instead", "2.0.0")
23+
object AjaxException extends (dom.XMLHttpRequest => AjaxException)
24+
2025
/**
2126
* Wraps an XMLHttpRequest to provide an easy one-line way of making
2227
* an Ajax call, returning a Future.
2328
*/
29+
@deprecated("use the dom.fetch API instead", "2.0.0")
2430
object Ajax {
2531

2632
/**

0 commit comments

Comments
 (0)