Giter Club home page Giter Club logo

Comments (7)

anandthakker avatar anandthakker commented on June 12, 2024

Here's what I've tracked down so far, based liberal use of console.log. (If anyone knows how to get node inspector to step into jsdom-run javascript, do tell!)

Deep in MathJax's callback management, it's using instanceof to test whether arguments Arrays or other things. This actually ends up testing whether the object inherits from window.Array.

Restarting the API via start() creates a new window object, but it looks like somehow, MathJax's window continues to refer to the one that was created in the first call to start().

This means that even though the API is intelligently using window.Array (via the $$ function) to create the arrays it's passing along to MathJax, instanceof causes problems the second time around..

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

Sorry or the long delay in getting back to you. Teaching has been taking all my time.

First, MathJax-node was not designed to allow multiple configurations, and providing for that would require more coordination with the API. I will look into how hard that would be, but it would take more than just handling the instanceof that you have identified.

The idea was that only one copy of MathJax would be running, and you would not have to load it for each page or (or equation when mj-single was used), but that the same MathJax would continue to serve the second and subsequent jobs. Once MathJax is running, not everything can be reconfigured (e.g., the font choice for HTML-CSS output), and so allowing configuration switching would mean killing and reloading MathJax, which we were trying to avoid.

The reason that the $$ function doesn't help is that $$ is set up as window.Array based on the window that was created initially, and isn't updated if you restart MathJax. So (as you point out), you end up using Array objects from the wrong window.

I will have to look into what can be done to improve the situation.

from mathjax-node.

anandthakker avatar anandthakker commented on June 12, 2024

@dpvc And sorry for my long delay in return. Definitely understand about teaching!

Am I correct in thinking that this seems to have been fixed by e8b8186?

from mathjax-node.

dpvc avatar dpvc commented on June 12, 2024

No, I don't think that commit will alter the situation. It was not intended to. I am planning a rewrite to make multiple configurations possible, but that hasn't been done yet. Once the term is ended, I should be able to put more effort into it.

from mathjax-node.

anandthakker avatar anandthakker commented on June 12, 2024

Hmm. Well, strangely, the case I posted above now works just fine. I'm a bit pressed for time right now, but when I've got a minute I'll try to investigate the commit that changed this and why.

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

This bug is about mj-page so please note #206; I'm guessing some of this applies to mj-single as well though.

from mathjax-node.

pkra avatar pkra commented on June 12, 2024

Closing this since a) this problems seems to have gone away on its own b) this is about mj-page which was deprecated in v1.

Feel free to open a new issue if you still see this.

from mathjax-node.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.