极客时间对于推广渠道会有返利优惠,比如山月在极客时间买了一门课,再把课程分享给好友购买,这时极客时间会向山月返利20元左右。
而我现在做了一个返利平台,你可以在上边通过山月的链接购买课程,此时极客时间会向我返利。为了共同学习,而你可以添加我的微信 (shanyue94),我将把极客时间给我的返利发一个红包全部返给你

# WASM 入门

# 目标

在浏览器或者 Node.js 中运用其它编程语言提供的功能进行编码。

wasm-web

wasm-node

  1. 可移植。比浏览器更丰富的功能,如图片在线压缩。
  2. 高性能。比 Node 更高的性能。
  3. 可调试

# 术语

int main() { 
  return 42;
}
var wasmModule = new WebAssembly.Module(wasmCode);
var wasmInstance = new WebAssembly.Instance(wasmModule, wasmImports);
log(wasmInstance.exports.main());
  • Module
  • Instance
  • memory

# 使用 C+++ 编写第一个 WASM

# 从 C++/Rust/Go 到 JS

C++ -> WASM -> JS
  1. C++。使用 C++ 编写源码。
  2. C++ Binary。把源码编译为二进制。
  3. WebAssembly 实例化。在 JS 中通过 WebAssembly API 加载运行模块,进行实例化。
  4. JS。

# 实例化

fetch('module.wasm').then(response =>
  response.arrayBuffer()
).then(bytes =>
  WebAssembly.instantiate(bytes, importObject)
).then(results => {
  // Do something with the compiled results!
});

#

关于山月

我的项目:
我的微信:shanyue94,欢迎交流
Last Updated: 7/21/2019, 11:25:08 AM