
WebAssembly in Action
Description
Alles über E-Books | Antworten auf Fragen rund um E-Books, Kopierschutz und Dateiformate finden Sie in unserem Info- & Hilfebereich.
WebAssembly in Action introduces the WebAssembly stack and walks you through the process of writing and running browser-based applications. Expert developer Gerard Gallant gives you a firm foundation of the structure of a module, HTML basics, JavaScript Promises, and the WebAssembly JavaScript API.
About the technology
Write high-performance browser-based applications without relying only on JavaScript! By compiling to the WebAssembly binary format, your C, C++, or Rust code runs at near-native speed in the browser. WebAssembly delivers greater speed, opportunities to reuse existing code, and access to newer and faster libraries. Plus, you can easily interact with JavaScript when you need to.
About the book
WebAssembly in Action teaches you how to write and run high-performance browser-based applications using C++ and other languages supported by WebAssembly. In it, you'll learn to create native WebAssembly modules, interact with JavaScript components, and maximize performance with web workers and pthreads. And you'll love how the clearly organized sections make it a breeze to find the important details about every function, feature, and technique.
What's inside
Dynamic linking of multiple modules at runtime
Communicating between modules and JavaScript
Debugging with WebAssembly Text Format
Threading with web workers and pthreads
About the reader
Written for developers with a basic understanding of C/C++, JavaScript, and HTML.
About the author
Gerard Gallant is a Microsoft Certified Professional and a Senior Software Developer at Dovico Software. He blogs regularly on Blogger.com and DZone.com.
More details
Other editions
Additional editions

Person
Content
- Intro
- Copyright
- Brief Table of Contents
- Table of Contents
- Preface
- Acknowledgments
- About this Book
- About the Author
- About the Cover Illustration
- Part 1. First steps
- Chapter 1. Meet WebAssembly
- 1.1. What is WebAssembly?
- 1.2. What problems does it solve?
- 1.3. How does it work?
- 1.4. Structure of a WebAssembly module
- 1.5. WebAssembly text format
- 1.6. How is WebAssembly secure?
- 1.7. What languages can I use to create a WebAssembly module?
- 1.8. Where can I use my module?
- Summary
- Chapter 2. A look inside WebAssembly modules
- 2.1. Known sections
- 2.2. Custom sections
- Summary
- Chapter 3. Creating your first WebAssembly module
- 3.1. The Emscripten toolkit
- 3.2. WebAssembly modules
- 3.3. Emscripten output options
- 3.4. Compiling C or C++ with Emscripten and using the HTML template
- 3.5. Having Emscripten generate the JavaScript plumbing code
- 3.6. Having Emscripten generate only the WebAssembly file
- 3.7. Feature detection: How to test if WebAssembly is available
- Real-world use cases
- Exercises
- Summary
- Part 2. Working with modules
- Chapter 4. Reusing your existing C++ codebase
- 4.1. Using C or C++ to create a module with Emscripten plumbing
- 4.2. Using C or C++ to create a module without Emscripten
- Real-world use cases
- Exercises
- Summary
- Chapter 5. Creating a WebAssembly module that calls into JavaScript
- 5.1. Using C or C++ to create a module with Emscripten plumbing
- 5.2. Using C or C++ to create a module without Emscripten plumbing
- Real-world use cases
- Exercises
- Summary
- Chapter 6. Creating a WebAssembly module that talks to JavaScript using function pointers
- 6.1. Using C or C++ to create a module with Emscripten plumbing
- 6.2. Using C or C++ to create a module without Emscripten plumbing
- Real-world use cases
- Exercises
- Summary
- Part 3. Advanced topics
- Chapter 7. Dynamic linking: The basics
- 7.1. Dynamic linking: Pros and cons
- 7.2. Dynamic linking options
- 7.3. Dynamic linking review
- Real-world use cases
- Exercises
- Summary
- Chapter 8. Dynamic linking: The implementation
- 8.1. Creating the WebAssembly modules
- 8.2. Adjusting the web page
- Real-world use cases
- Exercises
- Summary
- Chapter 9. Threading: Web workers and pthreads
- 9.1. Benefits of web workers
- 9.2. Considerations for using web workers
- 9.3. Prefetching a WebAssembly module using a web worker
- 9.4. Using pthreads
- Real-world use cases
- Exercises
- Summary
- Chapter 10. WebAssembly modules in Node.js
- 10.1. Revisiting what you know
- 10.2. Server-side validation
- 10.3. Working with Emscripten-built modules
- 10.4. Using the WebAssembly JavaScript API
- Real-world use cases
- Exercises
- Summary
- Part 4. Debugging and testing
- Chapter 11. WebAssembly text format
- 11.1. Creating the game's core logic using WebAssembly text format
- 11.2. Generating a WebAssembly module from the text format
- 11.3. The Emscripten-generated module
- 11.4. Creating the HTML and JavaScript files
- 11.5. Viewing the results
- Real-world use cases
- Exercises
- Summary
- Chapter 12. Debugging
- 12.1. Extending the game
- 12.2. Adjusting the HTML
- 12.3. Displaying the number of tries
- 12.4. Incrementing the number of tries
- 12.5. Updating the summary screen
- Exercises
- Summary
- Chapter 13. Testing-and then what?
- 13.1. Installing the JavaScript testing framework
- 13.2. Creating and running tests
- 13.3. Where do you go from here?
- Exercises
- Summary
- Appendix A. Installation and tool setup
- A.1. Python
- A.2. Emscripten
- A.3. Node.js
- A.4. WebAssembly Binary Toolkit
- A.5. Bootstrap
- Appendix B. ccall, cwrap, and direct function calls
- B.1. ccall
- B.2. cwrap
- B.3. Direct function calls
- B.4. Passing an array to a module
- Appendix C. Emscripten macros
- C.1. emscripten_run_script macros
- C.2. EM_JS macros
- C.3. EM_ASM macros
- Appendix D. Exercise solutions
- D.1. Chapter 3
- D.2. Chapter 4
- D.3. Chapter 5
- D.4. Chapter 6
- D.5. Chapter 7
- D.6. Chapter 8
- D.7. Chapter 9
- D.8. Chapter 10
- D.9. Chapter 11
- D.10. Chapter 12
- D.11. Chapter 13
- Appendix E. Text format extras
- E.1. Control flow statements
- E.2. Function pointers
- WebAssembly in Action
- Index
- List of Figures
- List of Tables
- List of Listings
System requirements
File format: ePUB
Copy protection: Adobe-DRM (Digital Rights Management)
System requirements:
- Computer (Windows; MacOS X; Linux): Install the free reader Adobe Digital Editions prior to download (see eBook Help).
- Tablet/smartphone (Android; iOS): Install the free app Adobe Digital Editions or the app PocketBook before downloading (see eBook Help).
- E-reader: Bookeen, Kobo, Pocketbook, Sony, Tolino and many more (not Kindle).
The file format ePub works well for novels and non-fiction books – i.e., „flowing” text without complex layout. On an e-reader or smartphone, line and page breaks automatically adjust to fit the small displays.
This eBook uses Adobe-DRM, a „hard” copy protection. If the necessary requirements are not met, unfortunately you will not be able to open the eBook. You will therefore need to prepare your reading hardware before downloading.
Please note: We strongly recommend that you authorise using your personal Adobe ID after installation of any reading software.
For more information, see our ebook Help page.