Skip to content

Commit 95644e7

Browse files
committed
Separate TypesetDone into two routines so that the processing of the results (in particular the PNG production) isn't part of the restart timer, since that can take a while.
1 parent 884c8b2 commit 95644e7

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/mj-single.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -517,11 +517,12 @@ function StartQueue() {
517517
timer = setTimeout(RestartMathJax,data.timeout);
518518
HUB.Queue(
519519
$$("Typeset",HUB),
520+
$$(TypesetDone,result),
520521
$$(GetMML,result),
521522
$$(GetSpeech,result),
522523
$$(GetSVG,result),
523524
$$(GetPNG,result),
524-
$$(TypesetDone,result)
525+
$$(ReturnResult,result)
525526
);
526527
}
527528

@@ -562,9 +563,7 @@ function GetState(state) {
562563
//
563564
// When the expression is typeset,
564565
// clear the timeout timer, if any,
565-
// update the MathJax state,
566-
// return the result object, and
567-
// do the next queued expression
566+
// and update the MathJax state,
568567
//
569568
function TypesetDone(result) {
570569
if (timer) {clearTimeout(timer); timer = null}
@@ -582,6 +581,13 @@ function TypesetDone(result) {
582581
state.n = GLYPH.n;
583582
state.ID = ID;
584583
}
584+
}
585+
586+
//
587+
// Return the result object, and
588+
// do the next queued expression
589+
//
590+
function ReturnResult(result) {
585591
if (errors.length) {result.errors = errors}
586592
callback(result);
587593
serverState = STATE.READY;

0 commit comments

Comments
 (0)