I’m trying to compile some C++ via emscripten and run it in the browser. I found issues like this which had some helpful ideas, but I feel like I’ve followed a relatively simple pathway and can’t quite figure out what’s going wrong.
I’ve created a notebook which pretty fully describes the issue here:
The fundamental problem is that it works pretty effortlessly in node and in the browser, but I can’t figure out why it seems to load and run but completely hang in Observable.
To clarify, perhaps my problem in addition to getting it to just work is that I’m having a bit of trouble understanding what Observable might be doing or trying to do, or why after trying this all Observable notebooks hang until I quit the browser.
The problem is that the Initialize method returns a then-able: an object that exposes a then method. The then method resolves with itself, so it goes into an infinite loop. In short, it’s like this:
Thanks! Wow, that was not the answer I expected. That solves it immediately. Perhaps MODULARIZE is not the option I’m looking for, or perhaps I could kludge around this within the bundle by injecting my own --post-js, but I’m willing to go with it and deal with this awkward thing.