Skip to content

Deprecate AJAX more quietly #607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/main/scala/org/scalajs/dom/ext/Ajax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ import scala.scalajs.js.typedarray.ArrayBufferView
import scala.scalajs.js.typedarray.TypedArrayBufferOps._

/** Wraps an XMLHttpRequest to provide an easy one-line way of making an Ajax call, returning a Future. */
@deprecated("use the dom.fetch API instead", "2.0.0")
@deprecated(
"scalajs-dom no longer includes custom utilities, only facades. Try using dom.fetch API which doesn't require additional utilities.",
"2.0.0")
object Ajax {

/** Supported data formats for Ajax are implicitly converted to InputData */
Expand Down
8 changes: 6 additions & 2 deletions src/main/scala/org/scalajs/dom/ext/AjaxException.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ import org.scalajs.dom
/** Thrown when `Ajax.get` or `Ajax.post` receives a non-20X response code. Contains the XMLHttpRequest that resulted in
* that response
*/
@deprecated("use the dom.fetch API instead", "2.0.0")
@deprecated(
"scalajs-dom no longer includes custom utilities, only facades. Try using dom.fetch API which doesn't require additional utilities.",
"2.0.0")
case class AjaxException(xhr: dom.XMLHttpRequest) extends Exception {
def isTimeout: Boolean = xhr.status == 0 && xhr.readyState == 4
}

// This is just there to work around some weird warnings in Scala 3.x
@deprecated("use the dom.fetch API instead", "2.0.0")
@deprecated(
"scalajs-dom no longer includes custom utilities, only facades. Try using dom.fetch API which doesn't require additional utilities.",
"2.0.0")
object AjaxException extends (dom.XMLHttpRequest => AjaxException)