Reputation: 917
In ScalaJS 1.2.0, having defined the following class:
@js.native
@JSGlobal
class ButtonProps(val title: String) extends js.Object
I expected that val props = new ButtonProps("foo")
would create a javascript instance (according to the doc).
But instead I get ButtonProps is not defined
. Any idea why?
Upvotes: 0
Views: 106
Reputation: 22085
The way you defined ButtonProps
, with @js.native @JSGlobal
, is telling Scala.js that it should not define ButtonProps
itself, and that instead it should get ButtonProps
from the JavaScript global scope. This only makes sense if some JavaScript code (e.g., in a library) actually defines that class.
If you meant to define ButtongProps
yourself in the Scala.js code, then you should remove @js.native @JSGlobal
and only keep
class ButtonProps(title: String) extends js.Object
Upvotes: 1