重新加载mathjax的Scala.js按钮

重新加载mathjax的Scala.js按钮,scala,mathjax,scala.js,Scala,Mathjax,Scala.js,我有一个scala函数,它创建了一个类似字符串的数学表达式 $\log((3+x))$每次单击按钮时。我希望在每次单击时调用mathjax,以允许它呈现新的表达式。 我读过类似于MathJax.Hub.Queue的东西,但是如何将它与scala.js一起使用 我的HTML文件: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Differanti

我有一个scala函数,它创建了一个类似字符串的数学表达式
$\log((3+x))$
每次单击按钮时。我希望在每次单击时调用mathjax,以允许它呈现新的表达式。
我读过类似于
MathJax.Hub.Queue
的东西,但是如何将它与scala.js一起使用

我的HTML文件:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Differantiator</title>
    <script type="text/x-mathjax-config">
    MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$'], ['\\(','\\)']]}});
 </script>
<script type="text/javascript" async
  src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML">
 </script>
</head>

<body>
  <form>
   Your expression to be differentiated:<br><br>
     <input type="text" name="expr" id="nodeValue">
     <input type="button"  onclick="addClickedMessage()"
           value="Differentiate!" id="click-me-button">
   </form> 
 <!-- Include Scala.js compiled code here -->
 <!-- Include JavaScript dependencies -->
  <script type="text/javascript" src="./target/scala-2.12/scala-js-tutorial-fastopt.js"></script>
 </body>
</html>

好吧,很简单…只是添加

 js.eval("MathJax.Hub.Queue([\"Typeset\",MathJax.Hub])")
诀窍是否

最简单的方法(不包括使用
js.eval()
)是使用
js.Dynamic

import js.Dynamic.{global=>g}
g、 队列(js.Array(“Typeset”,g.MathJax.Hub))
 js.eval("MathJax.Hub.Queue([\"Typeset\",MathJax.Hub])")