0%

Book Description

An example-driven guide covering modern web app development techniques and emerging technologies such as WebAssembly, Service Workers, and Svelte.js to build faster, secure, and scalable apps

Key Features

  • Discover effective techniques for accessing DOM, minimizing painting, and using a V8 engine to optimize JavaScript
  • Understand what makes the web tick and create apps that look and feel like native desktop applications
  • Explore modern JavaScript frameworks like Svelte.js for building next-gen web apps

Book Description

High-performance web development is all about cutting through the complexities in different layers of a web app and building services and APIs that improve the speed and performance of your apps on the browser. With emerging web technologies, building scalable websites and sustainable web apps is smoother than ever.

This book starts by taking you through the web frontend, popular web development practices, and the latest version of ES and JavaScript. You'll work with Node.js and learn how to build web apps without a framework. The book consists of three hands-on examples that help you understand JavaScript applications at both the server-side and the client-side using Node.js and Svelte.js. Each chapter covers modern techniques such as DOM manipulation and V8 engine optimization to strengthen your understanding of the web. Finally, you'll delve into advanced topics such as CI/CD and how you can harness their capabilities to speed up your web development dramatically.

By the end of this web development book, you'll have understood how the JavaScript landscape has evolved, not just for the frontend but also for the backend, and be ready to use new tools and techniques to solve common web problems.

What you will learn

  • Explore Vanilla JavaScript for optimizing the DOM, classes, and modules, and querying with jQuery
  • Understand immutable and mutable code and develop faster web apps
  • Delve into Svelte.js and use it to build a complete real-time Todo app
  • Build apps to work offline by caching calls using service workers
  • Write C++ native code and call the WebAssembly module with JavaScript to run it on a browser
  • Implement CircleCI for continuous integration in deploying your web apps

Who this book is for

This JavaScript book is for web developers, C/C++ programmers, and anyone who wants to build robust web applications using advanced web technologies. This book assumes a good grasp of Vanilla JavaScript and an understanding of web development tools, such as Chrome Developer tools or Mozilla's developer tools.

Table of Contents

  1. Title Page
  2. Copyright and Credits
    1. Hands-On JavaScript High Performance
  3. Dedication
  4. About Packt
    1. Why subscribe?
  5. Contributors
    1. About the author
    2. About the reviewer
    3. Packt is searching for authors like you
  6. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Conventions used
    4. Get in touch
      1. Reviews
  7. Tools for High Performance on the Web
    1. Technical requirements
    2. DevTools for different environments
      1. Edge
      2. Safari
      3. Firefox
      4. Chrome
    3. Chrome – an in-depth look at the Performance tab
    4. Chrome – an in-depth look at the Memory tab
    5. Chrome – an in-depth look at the Rendering tab
    6. jsPerf and benchmarking
    7. Summary
  8. Immutability versus Mutability - The Balance between Safety and Speed
    1. Technical requirements
    2. The current fascination with immutability
      1. A dive into Redux
      2. Immutable.js
    3. Writing safe mutable code
      1. Resource allocation is initialization (RAII)
    4. Functional style programming
      1. Lazy evaluation
      2. Tail-end recursion optimization
      3. Currying
    5. Summary
  9. Vanilla Land - Looking at the Modern Web
    1. Technical requirements
    2. A dive into modern JavaScript
      1. Let/const and block scoping
      2. Arrow functions
      3. Collection types
      4. Reflection and proxies
      5. Other notable changes
        1. Spread operator
        2. Destructuring
        3. Power operator
        4. Parameter defaults
        5. String templates
        6. Typed arrays
        7. BigInt
        8. Internationalization
    3. Understanding classes and modules
      1. Other notable features
      2. Modules
    4. Working with the DOM
      1. Query selector
      2. Document fragments
      3. Shadow DOM
      4. Web components
      5. Templates
    5. Understanding the Fetch API
      1. Promises
      2. Back to fetch
      3. Stopping fetch requests
    6. Summary
  10. Practical Example - A Look at Svelte and Being Vanilla
    1. Technical requirements
    2. A framework for pure speed
    3. Build the basics – a Todo application
    4. Getting fancier – a basic weather application
    5. Summary
  11. Switching Contexts - No DOM, Different Vanilla
    1. Technical requirements
    2. Getting Node.js
      1. Overview of the package.json file
    3. Understanding the DOM-less world
      1. A first look at streams
      2. A high-level look at modules
        1. fs module
        2. net module
        3. http module
    4. Debugging and inspecting code
    5. Summary
  12. Message Passing - Learning about the Different Types
    1. Technical requirements
    2. Local communication using the net module
      1. Understanding the cluster module
      2. Common pitfalls for new developers
    3. Utilizing the network
      1. TCP/UDP
      2. HTTP/2
    4. A quick glance at HTTP/3
      1. The QUIC protocol
      2. A look at node-quic
    5. Summary
  13. Streams - Understanding Streams and Non-Blocking I/O
    1. Technical requirements
    2. Getting started with streams
    3. Building a custom Readable stream
      1. Understanding the Readable stream interface
      2. Implementing the Readable stream
    4. Building a Writable stream
      1. Understanding the Writable stream interface
      2. Implementing the Writable stream
    5. Implementing a Duplex stream
    6. Implementing a Transform stream
      1. Understanding the Transform stream interface
      2. Implementing a Transform stream
    7. Using generators with streams
    8. Summary
  14. Data Formats - Looking at Different Data Types Other Than JSON
    1. Technical requirements
    2. Using JSON
    3. Implementing the encoder
    4. Implementing the decoder
    5. A look at data formats
    6. Summary
  15. Practical Example - Building a Static Server
    1. Technical requirements
    2. Understanding static content
      1. Starting our application
      2. Setting up our templating system
    3. Setting up our server
    4. Adding caching and clustering
    5. Summary
  16. Workers - Learning about Dedicated and Shared Workers
    1. Technical requirements
    2. Offloading work to a dedicated worker
    3. Moving data in our application
    4. Sending binary data in the browser
    5. Sharing data and workers
    6. Building a simple shared cache
    7. Summary
  17. Service Workers - Caching and Making Things Faster
    1. Technical requirements
    2. Understanding the ServiceWorker
    3. Caching pages and templates for offline use
    4. Saving requests for later
    5. Summary
  18. Building and Deploying a Full Web Application
    1. Technical requirements
    2. Understanding Rollup
      1. Building our static server into a single distributable
      2. Adding other file types to our distribution
      3. Bringing rollup into Node.js commands
    3. Integrating into CircleCI
      1. Adding our build steps
      2. Deploying our build
    4. Summary
  19. WebAssembly - A Brief Look into Native Code on the Web
    1. Technical requirements 
    2. Understanding WebAssembly
      1. Understanding a program
      2. Setting up our environment
    3. Writing WebAssembly modules
      1. Sharing memory between WebAssembly and JavaScript
      2. Writing FizzBuzz in WebAssembly
    4. Writing C/C++ for the web
      1. Writing a hamming code generator
    5. A look at SQLite in the browser
    6. Summary
    7. Further reading
  20. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think
3.140.185.147