2

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.

1 Answer 1

2

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.