-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can we have a synchronous call #10
Comments
Two problems with that: Technical. Initializing the WebAssembly module is in it's recommended form an async operation. There is a synchronous API but its use is discouraged. At least Chrome seems to impose a 4K hard limit on the module size if using the sync version. So that pretty much leaves the newly implemented browser API out of this discussion. Could possibly work on Node, though. There's relevant discussion at this mozilla/source-map issue, which is about them changing to fully asynchronous API because their implementation is now wasm-based. The current compiled wasm binary for this library is about 800K. There's probably room to trim, but reaching 4K seems unrealistic. Architectural. The current Node implementation launches a Worker thread to isolate the libxml2 from the main thread. I originally did that to prevent the emscripten compile result from calling However, I don't personally have use for a synchronous API so honestly it's unlikely that I'll spend time on implementing this in the near future at least. Also it should be considered that if the architectural changes make it very different from the current implementation and essentially split/duplciate the codebase, maybe at some point it stops making sense to include it here at all and just make a separate repo/package. So to summarize, For browsers: No. Can you provide a bit more concrete examples about what you are trying to do and the issues with
maybe there's something that can be done there to make it support async without re-architecting the whole app. If your app allows this kind of architecture, you could also separate the xmllint part into its own little Node.js application and just |
Closing as not planned. I'm willing to consider this if there's enough interest for someone else to implement it 😄 But I don't have a personal use case for this, and most likely fixing the application-side to be async, or making it do some tricks with blocking process invocations, would be the easier route to take. |
While Promises and asynchronous programming is all good in the context of JavaScript and Node.js, it is hard to include this API into a large existing codebase that is fully synchronous.
Ideally need to
1 and 2 can be done asynchronously and writing errors to console is, of course, ok, but 3 does not happen.
The text was updated successfully, but these errors were encountered: