Using import js.Dynamic.{ global => g} I am able to access the MathJax library as g.MathJax, but I can not find how to pass a function argument when calling a function from MathJax. I currently have the following: g.MathJax.Hub.Queue(["Typeset", g.MathJax.Hub]) which results in illegal start of simple expression which is of course because I am using square brackets, but I don't know how to properly pass the array with scalajs.
Add a comment
|
1 Answer
A JavaScript array is typed as a js.Array in Scala.js. So the square brackets "constructor" for arrays can be written with js.Array(...), like this:
import scala.scalajs.js
g.MathJax.Hub.Queue(js.Array("Typeset", g.MathJax.Hub))
More information on what Scala.js correspond to what JavaScript can be found in the documentation.