WebAssembly is one of the newest technologies on the web. It will be a huge change when it's ready. Chrome and Firefox released new versions that supports WebAssembly already.
Check out a Tanks! demo. If your browser does not support it yet, check out this video to see what WebAssembly can do in client side.
WebAssembly is low-level programming language for the client side. When it comes to the client side, JavaScript is the language today and WebAssembly is going to work with JavaScript to make programmers life easy.
Here are the some goals of WebAssemly from the group.
- Define a portable, size- and load-time-efficient binary format to serve as a compilation target which can be compiled to execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms, including mobile and IoT.
- Specify and implement incrementally:
- a Minimum Viable Product (MVP) for the standard with roughly the same functionality as asm.js, primarily aimed at C/C++;
-
additional features
,
initially focused on key features like threads,
zero cost exceptions, and SIMD,
follow by additional features
prioritized by feedback and experience, including support for languages
other than C/C++.
- Design to execute within and integrate well with the existing
Web platform:
- maintain the versionless, feature-tested and backwards-compatible evolution story of the Web;
- execute in the same semantic universe as JavaScript;
- 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; and
- define a human-editable text format that is convertible to and from the binary format, supporting View Source functionality.
- Design to support non-browser embeddings as well.
- Make a great platform:
- build a new LLVM backend for WebAssembly and an accompanying clang port (why LLVM first?);
- promote other compilers and tools targeting WebAssembly; and
- enable other useful tooling.
WebAssembly API
WebAssembly
This is the object work just like a namespace for all WebAssembly related functionalities. It is not a constructor.
WebAssembly.Module
This object contains stateless WebAssembly code that is ready (code has been compiled already). It can be shared with JavaScript APIs (Workers, IndexedDB)
WebAssembly.Instance
This object is a stateful and executable of WebAssembly.Module. It contains all the exported webassembly functions that allow calling into WebAssembly code from JavaScript.
WebAssembly.instantiate()
This function is the for compiling and instantiating webassembly code.
WebAssembly.Memory()
This is a constructor creates a new Memory object which is resizable ArrayBuffer. It holds raw bytes of memory accesed by WebAssembly Instance.
WebAssembly.Table()
This is a constructor that creates a new table object. It is a javascript wrapper object and It stores function references. A table can be created by JavaScript or Webassembly code and it is mutable from JavaScript and WebAssembly.
WebAssembly.CompileError()
It creates a new CompleError object. This function is a contructor and CompileError indicates an error during WebAssembly decoding or validation.
WebAssebmly.LinkError()
Create a new LinkError object. This is a contructor and LinkError indicates and error during module instantiation.
WebAssembly.RuntimeError()
This is a constructor which creates a RunTimeError object. It is thrown whenever WebAssembly spefies a trap.

No comments:
Post a Comment