Hacker News new | ask | show | jobs
by aspirin 3514 days ago
WASM isn't related to JavaScript in any way. Maybe you were thinking of asm.js?

You cannot access the browser APIs from WASM so there is no tight coupling with the browser environment. I think non-browser use could make definately sense.

3 comments

According to the docs, high-level goals of WASM are to allow synchronous calls to and from JavaScript; enforce the same-origin and permissions security policies; access browser functionality through the same Web APIs that are accessible to JavaScript; ?

https://github.com/WebAssembly/design/blob/master/HighLevelG...

Here's how to interact with browser APIs and import/export functions via the WebAssembly JS API: http://webassembly.org/getting-started/js-api/
> You cannot access the browser APIs from WASM

Do you have a reference? I'm confused about why you wouldn't want to access browser APIs.

The high level goals of WASM do include access to browser APIs, but the MVP version that is being implemented now, does not yet allow it: https://github.com/WebAssembly/design/blob/master/JS.md

WASM code can call external functions defined per module, and the external code can be JS code that interacts with browser APIs. So indirect use of browser APIs is possible.

Right now it's more like Flash or Java applets, running in a sandbox within a sandbox.
Huh? WebAssembly, like asm.js before it, can access Web APIs (albeit via JS).
Not exactly. You have to export those APIs into the WebAssembly module. It's certainly possible to have a WASM implementation that doesn't provide web APIs, but is still WASM.