There is no API for checking this, but you can queue another function that can be used to tell you when the previous material is completed. For example:
var isDone = false;
MathJax.Hub.Queue(
["Typeset",MathJax.Hub],
function () {isDone = true}
);
You can then use
if (isDone) {
// MathJax typesetting complete
} else {
// MathJax typesetting still going on
}
to tell if MathJax is still running. You can use this technique, for example, to prevent additional Typeset calls fun being queued until the previous is completed, and then start a new one at that point if you would have queued one during the previous typeset. Something like
var isTypesetting = false, typesetNeeded = false;
function Typeset() {
if (isTypesetting) {
typesetNeeded = true;
} else {
isTypesetting = true;
MathJax.Hub.Queue(
["Typeset",MathJax.Hub],
TypesetFinished
);
}
}
function TypesetFinished() {
isTypesetting = false;
if (typesetNeeded) {
typesetNeeded = false;
Typeset();
}
}
should do the trick (though the code above is untested, but it should get you the right idea). Calls to Typeset() will not queue more than on typeset operation at a time, and will call Typeset again at the end if requests to Typeset() occurred while one typesetting operation was in progress.
Perhaps that will do what you need.
Davide