I'm trying to get the following code from scala-js/test/src/test/scala/scala/scalajs/test/jsinterop/DictionaryTest.scala to run in the Browser in a Scala.js project.
import scala.scalajs.js
val obj = js.eval("var dictionaryTest13 =
{ a: 'Scala.js', b: 7357 }; dictionaryTest13;")
val dict = obj.asInstanceOf[js.Dictionary[js.Any]]
var propCount = 0
var propString = ""
for (prop <- js.Dictionary.propertiesOf(dict)) {
propCount += 1
propString += dict(prop)
}
// g.console.log(...)
It gives me: java.lang.RuntimeException: stub
How can I get this to work and make use of bracket access, e.g. to run through a json Object given from js to scala.js, in analogy to the js pattern: for(i in obj) {obj[i]} ?
That serves the trivial purpose to iterate in a over json datastructure in a way that is not bound to specific attributes.
0.4.1. I can't reproduce any of your issues. But the RTE saying "stub" suggests that your compiler isn't in sync with your library. (js.Dictionary.propertiesOfis a compiler primitive, if it fails like this, the compiler didn't replace it).printStackTrace()to display it on the console.