Web Workers

Multithreaded Programs in JavaScript

Af Ido Green
Detaljer O'Reilly Media, Incorporated
ISBN 9781449322137
Sprog Engelsk
Vælg mellem
Pris 168,00 kr.
Paperback

Ikke på lager

Ikke på lager. Bestil nu og få den leveret om ca. 12 hverdage

Web apps would run much better if heavy calculations could be performed in the background, rather than compete with the user interface. With this book, you'll learn how to use Web Workers to run computationally intensive JavaScript code in a thread parallel to the UI. Yes, multi-threaded programing is complicated, but Web Workers provide a simple API that helps you be productive without the complex algorithms.

If you have an intermediate to advanced understanding of JavaScript--especially event handling and callbacks--you're ready to tackle Web Workers with the tools in this example-driven guide.

  • Start creating Web Workers and understand what they can and can't do
  • Determine which browser versions support the API
  • Use dedicated Web Workers for tasks that consume a lot of CPU, such as data parsing
  • Explore use cases for creating inline Workers, such as encapsulating a web app in one page
  • Create a shared Worker to communicate multiple web app instances to the server, and other uses
  • Learn best practices for debugging Web Workers
  • Apply Web Workers within the server-side Node environment

;Preface; How This Book Is Organized; Who This Book Is For; Conventions Used in This Book; Using Code Examples; Safari® Books Online; How to Contact Us; Acknowledgments;
Chapter 1: Overview;
1.1 What Can Web Workers Do?;
1.2 Creating a Worker;
1.3 What Web Workers Can and Can't Do;
1.4 Worker Execution;
1.5 Web Workers API Browser Availability;
Chapter 2: How and Where Can We Use Web Workers?;
2.1 Loading External Scripts;
Chapter 3: Dedicated Workers;
3.1 Control Your Web Workers;
3.2 Parsing Data with Workers;
3.3 Transferable Objects;
Chapter 4: Inline Workers;
Chapter 5: Shared Workers;
Chapter 6: Debug Your Workers;
6.1 Debugging in Chrome Dev Tools;
Chapter 7: Web Workers Beyond the Browser: Node;
7.1 Processes;
7.2 Communications;
7.3 Message Format;
7.4 Code;
7.5 API;
7.6 Additional Resources;