Use retryAfter() and handleRetriesFor() from mathjax so they are easier to override - #1547
Use retryAfter() and handleRetriesFor() from mathjax so they are easier to override#1547dpvc wants to merge 3 commits into
mathjax so they are easier to override#1547Conversation
…sier to override
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #1547 +/- ##
===========================================
+ Coverage 86.92% 86.98% +0.05%
===========================================
Files 390 390
Lines 87853 87764 -89
Branches 4984 4983 -1
===========================================
- Hits 76370 76343 -27
+ Misses 11464 11402 -62
Partials 19 19 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
zorkow
left a comment
There was a problem hiding this comment.
I have two concerns about the new async loading. Please have a look.
| dynamic.promise = Promise.resolve(); | ||
| try { | ||
| mathjax.asyncLoad(this.dynamicFileName(dynamic)); | ||
| asyncLoad(this.dynamicFileName(dynamic)); |
There was a problem hiding this comment.
This now returns a promise regardless of if it fails or not. So the try...catch does not really have an effect on this. But that means that dynamic.failed is never set. That would mean the file is set to loaded
even if the promise failed.
| if (!loaded[file]) { | ||
| loaded[file] = true; | ||
| const promise = mathjax.asyncLoad(`./util/entities/${file}.js`); | ||
| const promise = asyncLoad(`./util/entities/${file}.js`); |
There was a problem hiding this comment.
Similarly, should the promise failure here not be handled explicitly?
|
I have put back the |
No, that looks good now. |
This PR moves the references to
retryAfter()andhandleRetriesFor()to the version in themathjaxvariable rather than from theRetries.tsmodule directly. This makes it easier to override them. I have an example of making MathJax load tex extensions synchronously that would be helped by this, as that means there would be fewer methods that need to be overridden. Together with the synchronous loading of dynamic font data and of entity definitions, this would allow MathJax to be run synchronously in node applications, where synchronous file loading can be achieved.Note that
asyncLoadusesmathjax.asyncLoadinternally, so we don't have to usemathjaxfor that.