In index-dev.html
I load a local JavaScript file:
<script type="text/javascript" src="map.js"></script>
map.js
structurally (not literally) looks like this:
var a2b = {
"a": "My life closed twice before its close—",
"b": "It yet remains to see",
"c": "If Immortality unveil",
"d": "A third event to me",
"e": "So huge, so hopeless to conceive",
"f": "As these that twice befell.",
"g": "Parting is all we know of heaven,",
"h": "And all we need of hell.",
"z": "Emily Dickinson, 1830-1886"
}
I figured out how to load this object into Scala.js:
val a2b = js.Dynamic.global.a2b
Now a2b
is of type Dynamic
. What I want is Map[String,String]
.
I tried this:
val a2b = js.Dynamic.global.a2b.asInstanceOf[Map[String,String]]
but that didn't work. What should I do to get a Map[String,String]
?