WASM 示例
WASM by example

原始链接: https://wasmbyexample.dev/home.en-us.html

总之,《Wasm By Examples》是一本指南,旨在通过动手编码练习向读者介绍 WebAssembly 的基础知识和实际应用。 该资源包括涵盖核心概念的解释和示例,例如导出、从 JavaScript 函数导入、读写图形和音频以及系统接口 (WASI) 的使用。 该方法为有兴趣在浏览器内部和外部利用 WebAssembly 潜在功能的开发人员提供了一种简洁、直接的掌握 WebAssembly 的方法。 由 Aaron Turner 开发并由才华横溢的合作者贡献。 示例、源代码和其他资源的完整列表可在线获取。

总体而言,使用 WASM 进行传统 Web 开发的主要问题是失去对网站内导航和历史管理的控制。 虽然它允许直接访问 DOM,如给定材料中所述,但它会在单独的选项卡中打开新页面、在历史记录中推送错误条目并导致滚动位置重置到顶部时产生问题。 与点击链接的传统做法相比,这导致无缝用户体验明显较差。 学习 WASM 的另一个挑战是,它需要底层系统编程方面的专业知识,这与 JavaScript 不同,JavaScript 的语法更简单,需要记住的系统级细节更少。 但是,可以使用 WASM 作为编译目标,利用各种已建立的语言库并创建自定义 C++ 代码等。 最终,WASM 最好与传统 Web 技术结合使用,作为将低级系统编程技能集成到 Web 开发中的替代方法,特别是对于实时应用程序、模拟和游戏,而不是作为传统语言的替代品。
相关文章

原文

WebAssembly (Wasm) is an universal low level bytecode that runs on the web. It is a compilation target for languages like Rust, AssemblyScript (Typescript-like), Emscripten (C/C++), and much more! Wasm offer a compact binary format with predictable performance, and portability to run alongside Javascript and other host languages. Wasm is currently shipped in all major browsers, and has runtimes meant for running on servers or interfacing with systems using WASI.

What is Wasm By Example?

Wasm By Example is a concise, hands-on introduction to WebAssembly using code snippets and annotated WebAssembly example programs. Learn more about Wasm at the WebAssembly Introduction or browse the list of examples below.

Concepts

Examples that express some of the major underlying concepts in WebAssembly. Some of these examples are not the most convenient or productive way for building projects with WebAssembly. However, these minimal examples are great for learning, or developing straightforward / lower-level parts of an application.

Applying the Concepts

Examples that expand on the conceptual examples to show how these minimal examples could be used to build common features in larger applications.

Ecosystem tools and Language features

Examples that highlight tools, libraries, and features of your selected programming language. These ecosystem components can drastically help in building powerful applications. For example, tools can be used to help pass data between your host runtime and WebAssembly module, and/or languages features can abstract away some of the lower-level parts of WebAssembly such as memory management.

WebAssembly Outside of the Browser

Examples that highlight the WebAssembly System Interface (WASI), standalone WebAssembly runtimes, tools for applications that use WASI, and use cases for tasks like cloud computing and internet-of-things devices. WebAssembly has a lot of key features that make it great for the browser web, and these same features make it a popular choice for uses outside of the browser as well.


联系我们 contact @ memedata.com