Hacker News new | ask | show | jobs
by asmos7 1854 days ago
basically node exposes all these other APIs like reading a file from disk. Browser also has APIs like detecting when the page is fully loaded that wouldn't be available on Node. What JavaScript syntax is supported can also vary between Node and browsers.
1 comments

WASM cannot magically load from disk, there is browser protection, right?
It can't access the file system, but it could implement an API that emulates a file system inside the browser sandbox. Presumably that's what they're doing here.
But you can do that same API emulation in regular browser JavaScript, too. What's the WASM intermediate buying here?
I think it is more complicated to emulate those api in normal browser environment compared to emulating some OS api for running node.js.
Why? It's literally JavaScript on both sides - what's complicated here?
Because many node.js api are written in C/C++, it might be easier to implements OS features instead of rewriting in JS. This is just my assumption.