
Learn WebAssembly
Build web applications with native performance using Wasm and C/C++
- 328 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
About this book
In the first definitive guide on WebAssembly, you'll learn how you can wield this new technology to break through the current barriers of web development and build an entirely new class of performant applications.
Key Features
- Generate WebAssembly modules from C and C++ using Emscripten and interact with these modules in the browser
- Learn how to use WebAssembly outside of the browser and load modules using Node.js
- Build a high-performance application using C and WebAssembly and port an existing C++ game to WebAssembly using Emscripten
Book Description
WebAssembly is a brand-new technology that represents a paradigm shift in web development. This book teaches programmers to leverage this technology to write high-performance applications that run in the browser. This book introduces you to powerful WebAssembly concepts to help you write lean and powerful web applications with native performance. You start with the evolution of web programming, the state of things today, and what can be done with the advent and release of WebAssembly. We take a look at the journey from JavaScript to asm.js to WebAssembly. We then move on to analyze the anatomy of a WebAssembly module and the relationship between binary and text formats, along with the corresponding JavaScript API. Further on, you'll implement all the techniques you've learned to build a high-performance application using C and WebAssembly, and then port an existing game written in C++ to WebAssembly using Emscripten. By the end of this book, you will be well-equipped to create high-performance applications and games for the web using WebAssembly.
What you will learn
- Learn how WebAssembly came to be and its associated elements (text format, module, and JavaScript API)
- Create, load, and debug a WebAssembly module (editor and compiler/toolchain)
- Build a high-performance application using C and WebAssembly
- Extend WebAssembly's feature set using Emscripten by porting a game written in C++
- Explore upcoming features of WebAssembly, Node.js integration, and alternative compilation methods
Who this book is for
If you are a web developer or C/C++ programmer keen to leverage the powerful technology of WebAssembly to build high-performance web applications, then this book is for you.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Creating an Application from Scratch
- Write functions that perform simple computations with C
- Build a basic JavaScript application with Vue
- Integrate Wasm into your JavaScript application
- Identify the capabilities and limitations of WebAssembly in its current form
- Run and test a JavaScript application using browser-sync
Cook the Books – making WebAssembly accountable
Overview and functionality
- Tabs for switching between transactions and charts
- Table that displays transactions
- Buttons that allow a user to add, edit, or remove a transaction
- Modal dialog for adding/updating a transaction
- Pie charts to display the income/expenses by category
JavaScript libraries used
Vue
UIkit
Lodash
Data-driven documents
Other libraries
C and the build process
Setting up the project
Table of contents
- Title Page
- Copyright and Credits
- Dedication
- PacktPub.com
- Contributors
- Preface
- What is WebAssembly?
- Elements of WebAssembly - Wat, Wasm, and the JavaScript API
- Setting Up a Development Environment
- Installing the Required Dependencies
- Creating and Loading a WebAssembly Module
- Interacting with JavaScript and Debugging
- Creating an Application from Scratch
- Porting a Game with Emscripten
- Integrating with Node.js
- Advanced Tools and Upcoming Features
- Other Books You May Enjoy