how to use end method for v4
I used this in version 2 to find out that mathjsx has finished rendering
window.MathJax.Hub.Register.StartupHook('End', function () { // some Write code });
What should I do now in version 4?
I also used those convert tools, it says: Version 3 uses promises rather than signals and queues window.MathJax.Hub.Register.StartupHook('End', function () {
});
I did not understand what to do
When MathJax was first written in 2008, there were few tools available in Javascript to handle coordination of asynchronous tasks, so we developed our own library based on queues, signals and callbacks. Since then, javascript has been expanded to include standard techniques for asynchronous coordination via the ES6 notation of promises, and the rewrite of MathJax for v3 switched to using promises rather than it non-standard queues and signals.
See the documentation for Performing Actions After Typesetting for details about how to synchronize your code with MathJax's initial typesetting. Note, however, that there is a bug in the handling of MathJax.startup-promise (see #3130) that will be fixed in the next beta release, so you should use the second approach given in the section cited above to avoid that.