I'm extending XMLHttpRequest in Scala.js:
class ReasonerHttpRequest(val reasonerId: String) extends XMLHttpRequest {}
Then, I try to create:
val http = new ReasonerHttpRequest(reasonerId)
This result in the following error:
TypeError: $g.ReasonerHttpRequest is not a constructor
What am I doing wrong? Thanks!
scalacOptions += "-P:scalajs:sjsDefinedByDefault"to your project'ssettingsin sbt?new.XMLHttpRequestwith an ES 5.1 function+prototype. Try emitting ES 2015 code from Scala.js usingscalaJSLinkerConfig ~= { _.withESFeatures(_.withUseECMAScript2015(true)) }. Note that this requires that your target browsers support ES 2015.