1

I have the following class

@js.native
class Foo extends js.Object {
  var bar: String = js.native

}

And in my JSApp I have

object TutorialApp extends JSApp {

  @JSExport
  val bar = new Foo()
}

When I run I get $g.Foo is not a constructor. Following the scalajs doc I can not get what I am doing wrong here.

KIC
  • 5,887
  • 7
  • 58
  • 98
  • That's a native facade. Are you sure you have included the JS library that declares `Foo` as a top-level constructor? – sjrd Jan 14 '17 at 07:25
  • @sjrd ah no. I want to write a facade for chartjs 2 but they have new Chart("canvasId", {...}). How would you instantiate the second arguments anonymous object? Since the lib mutates this object case classes do not work. – KIC Jan 14 '17 at 07:33
  • Ok, I found the solution here on SO http://stackoverflow.com/questions/26638171/how-do-i-create-options-objects-in-scala-js I was just confused of the usage of js.native – KIC Jan 14 '17 at 07:43

0 Answers0