WebAssembly ist eine Art Code, der in modernen Webbrowsern ausgeführt werden kann – es handelt sich um eine low-level, assembliesprachähnliche Programmiersprache mit einem kompakten binären Format, das fast in nativer Geschwindigkeit läuft und Sprachen wie C/C++, C# und Rust ein Kompilationsziel bietet, sodass sie im Web laufen können. Außerdem ist es darauf ausgelegt, neben JavaScript zu arbeiten, sodass beide zusammenarbeiten können.
WebAssembly hat große Auswirkungen auf die Webplattform – es bietet eine Möglichkeit, Code, der in mehreren Sprachen geschrieben wurde, mit nahezu nativer Geschwindigkeit im Web auszuführen. Dadurch können clientseitige Anwendungen im Web laufen, die dies zuvor nicht konnten.
WebAssembly ist darauf ausgelegt, JavaScript zu ergänzen und zusammen mit ihm zu arbeiten – mit den WebAssembly JavaScript-APIs können Sie WebAssembly-Module in eine JavaScript-Anwendung laden und Funktionalität zwischen beiden teilen. Dies ermöglicht es Ihnen, sowohl die Leistung und Stärke von WebAssembly als auch die Ausdruckskraft und Flexibilität von JavaScript in derselben Anwendung zu nutzen, selbst wenn Sie nicht wissen, wie man WebAssembly-Code schreibt.
Und das Beste daran ist, dass es als Webstandard über die W3C WebAssembly Arbeitsgruppe und die Community-Gruppe mit aktiver Beteiligung aller großen Browseranbieter entwickelt wird.
Beginnen Sie, indem Sie die übergeordneten Konzepte von WebAssembly lesen – was es ist, warum es so nützlich ist, wie es sich in die Webplattform (und darüber hinaus) einfügt und wie man es verwendet.
Wenn Sie Code in C/C++ geschrieben haben, können Sie ihn mit einem Tool wie Emscripten in Wasm kompilieren. Lassen Sie uns ansehen, wie es funktioniert.
Wenn Sie etwas Rust-Code geschrieben haben, können Sie ihn in WebAssembly kompilieren! Dieses Tutorial erklärt alles, was Sie wissen müssen, um ein Rust-Projekt in Wasm zu kompilieren und in einer vorhandenen Webanwendung zu verwenden.
Nachdem Sie ein Wasm-Modul haben, behandelt dieser Artikel, wie man es abruft, kompiliert und initialisiert, indem man die WebAssembly JavaScript API mit der Fetch oder XHR API kombiniert.
Sobald Sie ein Wasm-Modul geladen haben, möchten Sie es verwenden. In diesem Artikel zeigen wir Ihnen, wie Sie WebAssembly über die WebAssembly JavaScript API nutzen können.
Exportierte WebAssembly-Funktionen sind die JavaScript-Gegenstücke zu WebAssembly-Funktionen, die es ermöglichen, WebAssembly-Code aus JavaScript aufzurufen. Dieser Artikel beschreibt, was sie sind.
Dieser Artikel erklärt das Wasm-Textformat. Dies ist die low-level textuelle Darstellung eines Wasm-Moduls, die in den Entwicklerwerkzeugen des Browsers beim Debuggen angezeigt wird.
Ein WebAssembly.Global-Objekt repräsentiert eine globale Variableninstanz, die sowohl von JavaScript aus zugänglich ist als auch über eine oder mehrere WebAssembly.Module-Instanzen importiert/exportiert werden kann. Dies ermöglicht das dynamische Verknüpfen mehrerer Module.
Ein WebAssembly.Module-Objekt enthält zustandslosen WebAssembly-Code, der bereits vom Browser kompiliert wurde und effizient mit Workers geteilt und mehrfach instanziiert werden kann.
Ein WebAssembly.Instance-Objekt ist eine zustandsbehaftete, ausführbare Instanz eines Module. Instance-Objekte enthalten alle Exportierte WebAssembly-Funktionen, die das Aufrufen von WebAssembly-Code aus JavaScript ermöglichen.
Die WebAssembly.instantiateStreaming()-Funktion ist die primäre API zum Kompilieren und Instanziieren von WebAssembly-Code und gibt sowohl ein Module als auch seine erste Instance zurück.
Ein WebAssembly.Memory-Objekt ist ein dynamisch vergrößerbarer ArrayBuffer, der die Rohdatenbytes speichert, auf die von einer Instance zugegriffen wird.
Ein WebAssembly.Table-Objekt ist ein dynamisch vergrößerbares typisiertes Array undurchsichtiger Werte, wie Funktionsreferenzen, auf die von einer Instance zugegriffen wird.
Das WebAssembly.Exception-Objekt stellt eine Laufzeitausnahme dar, die von WebAssembly zu JavaScript oder von JavaScript zu einem WebAssembly-Ausnahme-Handler geworfen wird.
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No support
Non-standard. Check cross-browser support before using.
See implementation notes.
User must explicitly enable this feature.
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Tip: you can click/tap on a cell for more information.
Full support
Full support
No support
No support
The compatibility table on this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.