WebAssembly: The Definitive Guide is a thorough and accessible introduction to one of the most transformative technologies hitting our industry. What started as a way to use languages other than JavaScript in the browser has evolved into a comprehensive path toward portability, performance, increased security, and greater code reuse across an impressive collection of deployment targets.
Author Brian Sletten introduces elements of this technology incrementally while building to several concrete, code-driven examples of practical, cutting-edge WebAssembly uses. Whether you work with enterprise software or embedded systems, or in entertainment, scientific computing, or startup environments, you'll learn how WebAssembly can have a positive impact on the way you develop software.
• Use WebAssembly to increase code portability across platforms
• Reuse more of your software assets in a wider number of deployment targets
• Learn how WebAssembly increases protection against prominent security attacks
• Use WebAssembly to deploy legacy code in web environments
• Increase your user base across languages and development environments
• Integrate JavaScript code with other languages and environments to improve performance, security, and productivity
• Learn how WebAssembly will affect your career as software developer
Author(s): Brian Sletten
Edition: 1
Publisher: O'Reilly Media
Year: 2021
Language: English
Commentary: Vector PDF
Pages: 334
City: Sebastopol, CA
Tags: C++; .NET; Web Applications; Node.js; C; Rust; WebAssembly; TensorFlow.js; AssemblyScript
Cover
Copyright
Table of Contents
Preface
Conventions Used in This Book
Using Code Examples
O’Reilly Online Learning
How to Contact Us
Acknowledgments
Chapter 1. Introduction
What WebAssembly Offers
History of the Web
Origins of JavaScript
Evolution of the Web Platform
Native Client (NaCl)
asm.js
Rise of WebAssembly
Chapter 2. “Hello, World!” (Sort of)
WebAssembly Text Format (Wat)
Converting Wat to Wasm
Running Wasm in a Repl
Running Wasm in the Browser
Chapter 3. WebAssembly Modules
Module Structure
Exploring Module Sections
Working with Modules
Future ES6 Module Integration
Chapter 4. WebAssembly Memory
TypedArrays
WebAssembly Memory Instances
Using the WebAssembly Memory API
Strings at Last!
Chapter 5. Using C/C++ and WebAssembly
Using C Functions
Things Get Complicated
C/C++ and WebAssembly
Finally, “Hello, World!” in WebAssembly
Chapter 6. Applied WebAssembly: Legacy Code in the Browser
Proper “Hello, World!”
Porting Third-Party Code
libsodium
Chapter 7. WebAssembly Tables
Static Versus Dynamic Linking
Creating Tables in Modules
Dynamic Linking in WebAssembly
Chapter 8. WebAssembly in the Server
Native Extensions to Node.js
WebAssembly and Node.js
Supply Chain Attacks
WebAssembly and Deno
A Look Forward
Chapter 9. Applied WebAssembly: TensorFlow.js
Hardware
Playground
TensorFlow.js
WebAssembly Backend
Chapter 10. Rust
Introduction to Rust
Rust and WebAssembly
wasm-bindgen
Designing Code for In and Out of the Browser
Chapter 11. WebAssembly System Interface (WASI)
WebAssembly System Interface (WASI)
Capabilities-Based Security
The Bigger Picture
Chapter 12. Extending the WebAssembly Platform
WASI Runtimes
Multi-Value Return
Reference Types
Module Linking
Feature Testing
Other Proposals
Chapter 13. WebAssembly and .NET
.NET and Wasmtime
Blazor
Uno Platform
Chapter 14. Using AssemblyScript and WebAssembly
“Definitely Not a TypeScript to WebAssembly Compiler”
Simple Example
Garbage Collection and the AssemblyScript Runtime
AssemblyScript Standard Library
AssemblyScript Loader
Chapter 15. Applied WebAssembly: In the Cloud and on the Edge
A Short, Personal Detour
Our Industry Evolves
Fastly Compute@Edge
Krustlet
Suborbital
WasmEdge
wasmCloud
Chapter 16. Applied WebAssembly: Decentralized Applications
Centralization Versus Decentralization
From Bitcoin to Ethereum
How Do You Solve a Problem Like the Halting Problem?
ewasm
Polkadot
InterPlanetary File System (IPFS)
Chapter 17. WebAssembly and Other Languages
TinyGo
Artichoke
Swift
Java
Kotlin
Zig
Grain
And Then?
Appendix. Installing WebAssembly Tools
Installing WebAssembly Binary Toolkit (WABT)
Installing LLVM
Installing Emscripten
Installing Wasm3
Installing Wasmtime
Installing Wasmer
Installing Rust Tools
Installing .NET Tools
Installing AssemblyScript
Installing IPFS
Installing TinyGo
Installing Artichoke
Installing SwiftWasm
Installing Zig and Grain
Index
About the Author
Colophon