I am calling the Typeset
method as in code below. Right now, I have the callback function without any arguments and this works without any problems. However, I would prefer to pass an argument to the callback function of typeSetDone
rather than use a global variable called scripts
in the callback function.
Question : Is it possible to pass an argument to a callback function in this situation, and if yes then how would I pass it?
var scripts = [];
function someMethod()
MathJax.Hub.Queue(["Typeset", MathJax.Hub, element, typeSetDone]);
}
function typeSetDone() {
//do something here using the global scripts variable
}
The easiest is to queue the function right afterwards, e.g.,
var scripts = [];
function someMethod()
MathJax.Hub.Queue(["Typeset", MathJax.Hub, element]);
MathJax.Hub.Queue(typeSetDone);
}
function typeSetDone() {
//do something here using the global scripts variable
}
You might want to search the MathJax User Group for other examples.