diff --git a/ts/core/MathDocument.ts b/ts/core/MathDocument.ts index ea43073ac..12994cc06 100644 --- a/ts/core/MathDocument.ts +++ b/ts/core/MathDocument.ts @@ -36,7 +36,6 @@ import { MmlFactory } from '../core/MmlTree/MmlFactory.js'; import { DOMAdaptor } from '../core/DOMAdaptor.js'; import { BitField, BitFieldClass } from '../util/BitField.js'; import { PrioritizedList } from '../util/PrioritizedList.js'; -import { handleRetriesFor } from '../util/Retries.js'; import { localize } from './__locales__/Component.js'; import { Locale } from '../util/Locale.js'; import { mathjax } from '../mathjax.js'; @@ -883,7 +882,7 @@ export abstract class AbstractMathDocument implements MathDocument< */ public renderPromise() { return this.whenReady(() => - handleRetriesFor(async () => { + mathjax.handleRetriesFor(async () => { this.render(); await this.actionPromises(); this.clearPromises(); @@ -906,7 +905,7 @@ export abstract class AbstractMathDocument implements MathDocument< */ public rerenderPromise(start: number = STATE.RERENDER) { return this.whenReady(() => - handleRetriesFor(async () => { + mathjax.handleRetriesFor(async () => { this.rerender(start); await this.actionPromises(); this.clearPromises(); @@ -962,7 +961,7 @@ export abstract class AbstractMathDocument implements MathDocument< */ public convertPromise(math: string, options: OptionList = {}) { return this.whenReady(() => - handleRetriesFor(async () => { + mathjax.handleRetriesFor(async () => { const node = this.convert(math, options); await this.actionPromises(); this.clearPromises(); diff --git a/ts/input/tex/textmacros/TextMacrosMethods.ts b/ts/input/tex/textmacros/TextMacrosMethods.ts index 102c330d4..4fdc14bb5 100644 --- a/ts/input/tex/textmacros/TextMacrosMethods.ts +++ b/ts/input/tex/textmacros/TextMacrosMethods.ts @@ -21,9 +21,9 @@ * @author dpvc@mathjax.org (Davide P. Cervone) */ +import { mathjax } from '../../../mathjax.js'; import { HandlerType } from '../HandlerTypes.js'; import TexParser from '../TexParser.js'; -import { retryAfter } from '../../../util/Retries.js'; import { TextParser } from './TextParser.js'; import BaseMethods from '../base/BaseMethods.js'; @@ -290,7 +290,7 @@ export const TextMacrosMethods = { if (!macro || (autoload && macro._func === autoload.Autoload)) { texParser.parse(HandlerType.MACRO, [texParser, name]); if (!macro) return; - retryAfter(Promise.resolve()); + mathjax.retryAfter(Promise.resolve()); } texParser.parse(HandlerType.MACRO, [parser, name]); }, diff --git a/ts/output/common/FontData.ts b/ts/output/common/FontData.ts index b1fa5529b..2025a06c3 100644 --- a/ts/output/common/FontData.ts +++ b/ts/output/common/FontData.ts @@ -26,7 +26,6 @@ import { mathjax } from '../../mathjax.js'; import { OptionList, defaultOptions, userOptions } from '../../util/Options.js'; import { StyleJson } from '../../util/StyleJson.js'; import { asyncLoad } from '../../util/AsyncLoad.js'; -import { retryAfter } from '../../util/Retries.js'; import { Locale } from '../../util/Locale.js'; import { COMPONENT, localize } from '../../core/__locales__/Component.js'; import { DIRECTION } from './Direction.js'; @@ -1343,7 +1342,7 @@ export class FontData< this.loadDynamicFileSync(delim); return this.getDelimiter(n); } - retryAfter(this.loadDynamicFile(delim)); + mathjax.retryAfter(this.loadDynamicFile(delim)); return null; } return delim as DelimiterData; @@ -1395,7 +1394,7 @@ export class FontData< this.loadDynamicFileSync(char); return this.getChar(name, n); } - retryAfter(this.loadDynamicFile(char)); + mathjax.retryAfter(this.loadDynamicFile(char)); return null; } return char as CharDataArray; diff --git a/ts/ui/lazy/LazyHandler.ts b/ts/ui/lazy/LazyHandler.ts index 73c53ea93..a48f72648 100644 --- a/ts/ui/lazy/LazyHandler.ts +++ b/ts/ui/lazy/LazyHandler.ts @@ -30,7 +30,6 @@ import { HTMLDocument } from '../../handlers/html/HTMLDocument.js'; import { HTMLHandler } from '../../handlers/html/HTMLHandler.js'; // import { EnrichedMathItem } from '../../a11y/semantic-enrich.js'; import { SpeechMathItem } from '../../a11y/speech.js'; -import { handleRetriesFor } from '../../util/Retries.js'; import { OptionList } from '../../util/Options.js'; import { StyleJson } from '../../util/StyleJson.js'; @@ -568,7 +567,7 @@ export function LazyMathDocumentMixin< // Typeset the math and put back the font cache when done. // this.reset(); - return handleRetriesFor(() => this.render()).then(() => { + return this.renderPromise().then(() => { if (fontCache) this.outputJax.options.fontCache = fontCache; }); } @@ -622,16 +621,14 @@ export function LazyMathDocumentMixin< protected lazyHandleSet() { const set = this.lazySet; this.lazySet = new Set(); - this.lazyPromise = this.lazyPromise.then(() => { + this.lazyPromise = this.lazyPromise.then(async () => { let state = this.compileEarlierItems(set) ? STATE.COMPILED : STATE.TYPESET; state = this.resetStates(set, state); this.state(state - 1, null); // reset processed bits to allow reprocessing - return handleRetriesFor(() => { - this.render(); - this.lazyIdle = false; - }); + await this.renderPromise(); + this.lazyIdle = false; }); }