Skip to content

Latest commit

 

History

History
81 lines (65 loc) · 6.56 KB

File metadata and controls

81 lines (65 loc) · 6.56 KB
title slug
WebAssembly
WebAssembly

{{WebAssemblySidebar}}

WebAssembly 是一種新的低階程式語言,可在今日的網頁瀏覽器中被執行 —— 它是低階的類組合語言,具有嚴謹的二進位格式,能以接近原生應用程式的效能執行,並提供如 C/C++ 等語言一個構建目標,使它們能在 Web 上被執行。他也被設計為可與 JavaScript 共存,允許兩者一同工作。

簡而言之

WebAssembly 對於網路平台而言具有極大的意義 —— 它提供了一種方式,使得那些以各種語言編寫的程式都能以接近原生的速度於 Web 環境中執行,在這條件下,先前無法以此種方式運作的用戶端軟體皆能在 Web 中被執行。

WebAssembly 被設計來與 JavaScript 協同工作 —— 藉由 WebAssembly 的 JavaScript API,你可以把 WebAssembly 模組載入至一個 JavaScript 應用程式,並在兩者間共享功能。這允許你在同一應用程式內彈性地發揮 WebAssembly 的高效能威力同時兼顧 JavaScript 的表達力與高靈活性,即便你可能不知道如何編寫 WebAssembly 程式碼。

而且更棒的是,這是由 W3C WebAssembly Working GroupCommunity Group 開發的一項網路標準,並也得到來自各大主要瀏覽器廠商的積極參與。

指南

API 參考

  • WebAssembly 參考指令
    • : WebAssembly 運算子相關的說明文件,內含互動式範例。
  • WebAssembly JavaScript 介面
    • : 該物件充當所有與 WebAssembly 相關的功能的命名空間。
  • {{jsxref("Global_objects/WebAssembly", "WebAssembly")}}
    • : This object acts as the namespace for all WebAssembly related functionality.
  • {{jsxref("Global_objects/WebAssembly/Global", "WebAssembly.Global()")}}
    • : A WebAssembly.Global object represents a global variable instance, accessible from both JavaScript and importable/exportable across one or more {{jsxref("WebAssembly.Module")}} instances. This allows dynamic linking of multiple modules.
  • {{jsxref("Global_objects/WebAssembly/Module", "WebAssembly.Module()")}}
    • : A WebAssembly.Module object contains stateless WebAssembly code that has already been compiled by the browser and can be efficiently shared with Workers, and instantiated multiple times.
  • {{jsxref("Global_objects/WebAssembly/Instance", "WebAssembly.Instance()")}}
    • : A WebAssembly.Instance object is a stateful, executable instance of a Module. Instance objects contain all the Exported WebAssembly functions that allow calling into WebAssembly code from JavaScript.
  • {{jsxref("Global_objects/WebAssembly/instantiateStreaming", "WebAssembly.instantiateStreaming()")}}
    • : The WebAssembly.instantiateStreaming() function is the primary API for compiling and instantiating WebAssembly code, returning both a Module and its first Instance.
  • {{jsxref("Global_objects/WebAssembly/Memory", "WebAssembly.Memory()")}}
    • : A WebAssembly.Memory object is a resizable {{jsxref("Global_objects/ArrayBuffer", "ArrayBuffer")}} that holds the raw bytes of memory accessed by an Instance.
  • {{jsxref("Global_objects/WebAssembly/Table", "WebAssembly.Table()")}}
    • : A WebAssembly.Table object is a resizable typed array of opaque values, like function references, that are accessed by an Instance.
  • {{jsxref("WebAssembly.CompileError()")}}
    • : Creates a new WebAssembly CompileError object.
  • {{jsxref("WebAssembly.LinkError()")}}
    • : Creates a new WebAssembly LinkError object.
  • {{jsxref("WebAssembly.RuntimeError()")}}
    • : Creates a new WebAssembly RuntimeError object.

範本

規範

{{Specifications}}

參見