This PR implements the ideas we discussed in our meeting yesterday:
A new renderPromises array is added to the MathDocument that holds promises that are created by the render actions.
The typesetPromise() function now waits for those promises to resolve before its own promise resolves.
The attachSpeech() action now creates a promise that resolves when the speech loop completes so that typesetPromise() will wait for it to complete.
A new asynchronous option is added to the speechTiming configuration object, initially set to true, that controls whether the speech is added synchronously or asynchronously. (When set to false, the speech is added during the renderAction processing directly, which will be useful for node-based page preprocessing.)
In addition, a bug with the defaultPageReady() call is fixed, so that it will resolve the initial typesetting promise. That way, if a user provides a pageReady() configuration function, it can call the promise-based converters, which now wait on that promise before they run. That was causing a catch-22 where the pageReady() call never completed because the initial typeset promise was being resolved only in the ready() function (which calls pageReady()).
This PR implements the ideas we discussed in our meeting yesterday:
renderPromises
array is added to the MathDocument that holds promises that are created by the render actions.typesetPromise()
function now waits for those promises to resolve before its own promise resolves.attachSpeech()
action now creates a promise that resolves when the speech loop completes so thattypesetPromise()
will wait for it to complete.asynchronous
option is added to thespeechTiming
configuration object, initially set totrue
, that controls whether the speech is added synchronously or asynchronously. (When set tofalse
, the speech is added during therenderAction
processing directly, which will be useful for node-based page preprocessing.)In addition, a bug with the
defaultPageReady()
call is fixed, so that it will resolve the initial typesetting promise. That way, if a user provides apageReady()
configuration function, it can call the promise-based converters, which now wait on that promise before they run. That was causing a catch-22 where thepageReady()
call never completed because the initial typeset promise was being resolved only in theready()
function (which callspageReady()
).