Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
ECMAScript Cookbook

You're reading from   ECMAScript Cookbook Over 70 recipes to help you learn the new ECMAScript (ES6/ES8) features and solve common JavaScript problems

Arrow left icon
Product type Paperback
Published in Mar 2018
Publisher Packt
ISBN-13 9781788628174
Length 348 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
 Harrison Harrison
Author Profile Icon Harrison
Harrison
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Title Page
Copyright and Credits
Dedication
PacktPub.com
Contributors
Preface
1. Building with Modules FREE CHAPTER 2. Staying Compatible with Legacy Browsers 3. Working with Promises 4. Working with async/await and Functions 5. Web Workers, Shared Memory, and Atomics 6. Plain Objects 7. Creating Classes 8. Inheritance and Composition 9. Larger Structures with Design Patterns 10. Working with Arrays 11. Working with Maps and Symbols 12. Working with Sets 1. Other Books You May Enjoy Index

Index

A

  • abstract classes
    • simulating, throw used / Getting ready, How it works...
  • argument
    • class, passing as / Passing a class as an argument
  • Array#every
    • used, for testing array values / Using Array#every and Array#some to test array values, How to do it..., How it works...
  • Array#filter
    • used, for finding values in array / Using Array#find and Array#filter to find values in an array, How to do it..., How it works...
  • Array#find
    • used, for finding values in array / Using Array#find and Array#filter to find values in an array, How to do it..., How it works...
  • Array#slice
    • used, for obtaining subset of array / Using Array#slice to get a subset of the array, How to do it..., How it works...
  • Array#some
    • used, for testing array values / Using Array#every and Array#some to test array values, How to do it..., How it works...
  • Array.map
    • used, for producing values / Using Array.map to produce values, How it works...
  • Array.reduce
    • used, for transforming data / Using Array.reduce to transform data, How to do it..., How it works...
  • array members
    • extracting, with destructuring / Extracting array members with destructuring, How it works...
  • array of async results
    • collecting, Promise.all used / Using Promise.all to collect an array of async results, How it works...
  • arrays
    • combining, with spread operator / Combining arrays with the spread operator, How it works...
  • async function
    • promises, creating / Creating promises with an async function, How it works...
  • async results
    • using, in Promise chain / Using async results in a Promise chain
  • Atomics
    • used, for coordinating shared memory usage / Using Atomics to coordinate the use of shared memory, How to do it..., How it works...
  • await keyword
    • using / Awaiting the result of async functions, How it works...

B

  • Babel
    • new language features, supporting / Supporting new language features with Babel, How to do it..., How it works...
  • Babel Polyfill
    • methods, shimming / Shimming methods with Babel Polyfill, How to do it..., How it works...
  • Babel transpiler / How it works...
  • behavior
    • adding, mix-ins used / Using mix-ins to add behavior, How it works...
  • browsers support modules
    • reference / There's more...
  • builders
    • customized instances, assembling with / Assembling customized instances with builders, How to do it..., How it works...

C

  • Chrome
    • installing / Installing and configuring - Chrome, How to do it..., How it works...
    • configuring / Installing and configuring - Chrome, How to do it..., How it works...
    • download link / How to do it...
    • SharedArrayBuffers, enabling in / Enabling SharedArrayBuffers in Chrome, How it works...
  • class
    • creating / Creating a new class, How to do it..., How it works...
    • methods, defining on / Defining methods on a class, How it works...
    • extending / Extending a class, How to do it..., How it works...
    • passing, as argument / Passing a class as an argument
  • class inheritance
    • checking, with Object.getPrototypeOf / Checking class inheritance with Object.getPrototypeOf, How it works...
  • composition
    • using / Using composition rather than inheritance to add behavior, How to do it..., How it works...
  • constructor arguments
    • properties, assigning with / Assigning properties with constructor arguments, How it works..., Assigning additional properties with constructor arguments, How it works...
  • customized instances
    • assembling, with builders / Assembling customized instances with builders, How to do it..., How it works...

D

  • data
    • sending, to Web Worker / Sending data to a Web Worker, How it works...
    • transforming, Array.reduce used / Using Array.reduce to transform data, How to do it..., How it works...
    • Map, creating from / Creating a Map from the existing data, How it works...
    • WeakMap, creating from / Creating a WeakMap from existing data  
    • Set, creating from / Creating a Set from existing data, How it works...
    • WeakSet, creating from / Creating a WeakSet from existing data, How it works...
  • Dependency Inversion Principle (DIP)
    • reference / How it works...
  • design pattern
    • modifying, to fit use cases / Modifying an existing design pattern to fit different use cases, How to do it..., How it works...
    • combining, to fit use cases / Combining existing design patterns to fit different use cases, How to do it..., How it works...
  • destructuring
    • values, picking from object / Picking values from an object using destructuring, How it works...
    • array members, extracting / Extracting array members with destructuring, How it works...
  • difference
    • finding, between two sets / Finding the difference between two sets

E

  • entries
    • deleting, from Map / Setting and deleting entries from Map, How it works...
    • deleting / How it works...
    • deleting, from WeakMap / Setting and deleting entries from WeakMap, How it works...
  • enums
    • simulating, Symbol used / Using Symbol to simulate enums, How it works...
  • errors
    • handling, when awaiting async function / Handling errors when awaiting an async function, How to do it...
    • handling, thrown inside of Promise.all / Handling errors thrown inside of Promise.all, How to do it..., How it works...

F

  • factories
    • instances, replicating / Replicating instances with factories, How to do it..., How it works...
  • fallback script tags
    • adding, to load client bundles / Adding fallback script tags to load client bundles, How to do it..., How it works...
  • finally
    • simulating, with promise API / Simulating finally with the promise API, How to do it..., How it works...
    • used, for ensuring operation performance / Using finally to ensure an operation is performed, How to do it..., How it works...
  • Firefox
    • installing / Installing and configuring - Firefox, How to do it..., How it works...
    • configuring / Installing and configuring - Firefox, How to do it..., How it works...
    • installation link / How to do it...
    • SharedArrayBuffers, enabling in / Enabling SharedArrayBuffers in Firefox, How to do it..., How it works...
  • function properties
    • defining, as methods on plain object / Defining function properties as methods on a plain object, How it works...

G

  • getters
    • used, for creating read-only properties / Using getters to create read-only properties, How it works...
  • Git
    • reference / Getting ready
  • global instance
    • creating, Symbol.for used / Using Symbol.for to create a global instance, How it works...

H

  • head of array
    • obtaining, rest operator used / Getting the head and tail of array using the rest operator, How it works...
  • HTML page
    • creating, that loads ECMAScript module / Creating an HTML page that loads an ECMAScript module, How to do it..., How it works...

I

  • imported modules
    • renaming / Renaming imported modules, How to do it..., How it works...
  • instances
    • replicating, with factories / Replicating instances with factories, How to do it..., How it works...
    • managing, singleton used / Using a singleton to manage instances, How it works...
  • instance type
    • checking, with instanceOf / Checking instance type with instanceOf, How it works...
  • intersection, of two sets
    • finding / Finding the intersection of two sets, How to do it..., How it works...
  • items
    • adding, in Set / Adding and deleting items from a Set, How it works...
    • deleting, from Set / Adding and deleting items from a Set, How it works...
    • adding, in WeakSet / Adding and deleting items from WeakSet, How it works...
    • deleting, from WeakSet / Adding and deleting items from WeakSet, How it works...

L

  • Linux
    • Node.js, installing with NVM / Installing Node.js with NVM – Linux and macOS, How it works...
  • local instance
    • creating, Symbol used / Using Symbol to create a local instance, How to do it..., How it works...
  • local static file server
    • hosting, SimpleHTTPServer used / Installing Python, using SimpleHTTPServer to host a local static file server, How it works...
  • Long Term Support (LTS) / How to do it...

M

  • macOS
    • Node.js, installing with NVM / Installing Node.js with NVM – Linux and macOS, How it works...
  • Map
    • entries, setting from / Setting and deleting entries from Map
    • entries, deleting from / Setting and deleting entries from Map, How it works...
    • creating, from existing data / Creating a Map from the existing data, How to do it..., How it works...
    • wrapper class, creating for / Creating a class that wraps Map to work with specific complex types, Creating a class that wraps a Set to work with more complex types, How it works...
  • Meltdown
    • reference / How it works...
  • messages
    • sending, to Web Worker / Sending messages to and from Web Workers, How it works...
    • sending, from Web Workers / Sending messages to and from Web Workers, How it works...
  • methods
    • shimming, with Babel Polyfill / Shimming methods with Babel Polyfill, How to do it..., How it works...
    • defining, on class / Defining methods on a class, How it works...
  • mix-ins
    • used, for adding behavior / Using mix-ins to add behavior, How it works...
  • modules
    • importing / Exporting/importing multiple modules for external use, How to do it..., How it works...
    • exporting / Exporting/importing multiple modules for external use, How to do it..., How it works...
    • nesting, under single namespace / Nesting modules under a single namespace, How to do it..., How it works...
  • multiple results
    • awaiting, in series / Awaiting multiple results in a series, How it works...
    • awaiting, concurrently / Awaiting multiple results concurrently, How it works...

N

  • non-enumerable property
    • creating, with Object.defineProperty / Creating a non-enumerable property with Object.defineProperty, How it works...

O

  • Object.assign
    • used, for adding properties to object / Using Object.assign to add properties to an object, How to do it..., How it works...
  • Object.defineProperty
    • read-only props, defining / Defining read-only props with Object.defineProperty, How it works...
    • read-only props, overriding / Overriding read-only props with Object.defineProperty, How it works...
    • non-enumerable property, creating with / Creating a non-enumerable property with Object.defineProperty, How it works...
  • Object.entries
    • used, for obtaining iterable property-name pairs / Using Object.entries to get iterable property-name pairs, How it works...
  • Object.getPrototypeOf
    • used, for checking class inheritance / Checking class inheritance with Object.getPrototypeOf, How it works...
  • Object.is
    • used, for comparing values / Using Object.is to compare two values, How it works...
  • objects
    • creating, object structuring used / Creating an object using object structuring, How it works...
    • combining, spread operator used / Using a spread operator to combine objects, How it works...

P

  • parent class instance methods
    • overriding / Overriding parent class instance methods, How to do it..., How it works...
  • parent class static methods
    • overriding / Overriding parent class static methods, How to do it..., How it works...
  • plain object
    • function properties, defining as methods / Defining function properties as methods on a plain object, How it works...
  • Promise.all
    • used, for resolving promises / Using Promise.all to resolve multiple promises, How to do it..., How it works...
    • used, for collecting array of async results / Using Promise.all to collect an array of async results, How it works...
  • Promise.catch
    • errors, handling / Handling errors with Promise.catch, How it works...
  • promise API
    • finally, simulating / How to do it..., How it works...
  • Promise chain
    • starting, with Promise.resolve / Starting a Promise chain with Promise.resolve, How to do it...
    • async results, using in / Using async results in a Promise chain
  • promises
    • about / Creating and waiting for Promises
    • creating / How to do it..., How it works...
    • waiting for / How to do it..., How it works...
    • results, resolving / Resolving Promise results, How to do it..., How it works...
    • errors, rejecting / Rejecting Promise errors, How it works...
    • chaining / Chaining Promises, How to do it...
    • creating, with async function / Creating promises with an async function, How it works...
    • used, for providing simple interface for worker / Using promises to provide a simple interface for a worker, How to do it..., How it works...
  • properties
    • assigning, with constructor arguments / Assigning properties with constructor arguments, How it works..., Assigning additional properties with constructor arguments, How it works...
  • Python
    • installing / Installing Python, using SimpleHTTPServer to host a local static file server, How to do it...
    • download link / How to do it...

R

  • read-only properties
    • defining, with Object.defineProperty / Defining read-only props with Object.defineProperty, How it works...
    • overriding, with Object.defineProperty / Overriding read-only props with Object.defineProperty, How it works...
    • creating, getters used / Using getters to create read-only properties, How it works...
  • rest operator
    • used, for obtaining head of array / Getting the head and tail of array using the rest operator, How it works...
    • used, for obtaining tail of array / Getting the head and tail of array using the rest operator, How it works...

S

  • Sets
    • items, deleting from / Adding and deleting items from a Set, How it works...
    • items, adding in / Adding and deleting items from a Set, How it works...
    • reference / How it works...
    • creating, from existing data / Creating a Set from existing data, How it works...
    • difference, finding / Finding the difference between two sets
  • setters
    • used, for encapsulating values / Using setters to encapsulate values, How it works...
  • SharedArray
    • reading, from multiple Web Workers / Reading SharedArray from multiple Web Workers, How it works...
  • SharedArrayBuffer
    • enabling, in Firefox / Enabling SharedArrayBuffers in Firefox, How it works...
    • enabling, in Chrome / Enabling SharedArrayBuffers in Chrome, How it works...
    • creating / Creating SharedArrayBuffer, How to do it..., How it works...
    • sending, to Web Worker / Sending SharedArrayBuffer to a Web Worker, How it works...
  • SimpleHTTPServer
    • used, for hosting local static file server / Installing Python, using SimpleHTTPServer to host a local static file server, How it works...
  • singleton
    • used, for managing instances / Using a singleton to manage instances, How it works...
  • spread operator
    • used, for combining objects / Using a spread operator to combine objects, How it works...
    • used, for combining arrays / Combining arrays with the spread operator, How it works...
  • static methods
    • used, for working with instances / Using static methods to work with all instances, How it works...
  • steps
    • defining, with template functions / Defining steps with template functions, How to do it..., How it works...
  • structure
    • processing, with visitor pattern / Processing a structure with the visitor pattern, How to do it..., How it works...
  • super methods
    • calling / Calling super methods, How to do it..., How it works...
  • Symbol
    • used, for creating local instance / Using Symbol to create a local instance, How to do it..., How it works...
    • used, for simulating enums / Using Symbol to simulate enums, How it works...
  • Symbol.for
    • used, for creating global instance / Using Symbol.for to create a global instance, How it works...

T

  • tail of array
    • obtaining, rest operator used / Getting the head and tail of array using the rest operator, How it works...
  • template functions
    • steps, defining with / Defining steps with template functions, How to do it..., How it works...
  • terminate
    • workers, stopping with / Stopping workers with terminate, How it works...
  • throw
    • used, for simulating abstract classes / Using throw to simulate abstract classes, How it works...
  • tools
    • used, for analyzing webpack bundles / Using tools to analyze webpack bundles, How it works...

U

  • union of two sets
    • finding / Finding the union of two sets, How to do it..., How it works...

V

  • valid types
    • reference / How it works...
  • values
    • encapsulating, setters used / Using setters to encapsulate values, How it works...
    • producing, Array.map used / Using Array.map to produce values, How it works...
  • visitor pattern
    • structure, processing / Processing a structure with the visitor pattern, How to do it..., How it works...

W

  • WeakMap
    • entries, setting / Setting and deleting entries from WeakMap, How it works...
    • entries, deleting from / Setting and deleting entries from WeakMap, How it works...
    • reference / How it works...
    • creating, from existing data / Creating a WeakMap from existing data  
    • wrapper class, creating for / Creating a class that uses WeakMap to work with specific complex types
  • WeakSet
    • items, deleting from / Adding and deleting items from WeakSet, How it works...
    • items, adding in / Adding and deleting items from WeakSet, How it works...
    • creating, from existing data / Creating a WeakSet from existing data, How it works...
  • webpack
    • installing / Installing and configuring webpack, How to do it..., How it works...
    • configuring / Installing and configuring webpack, How to do it..., How it works...
    • reference / How it works...
  • webpack bundles
    • analyzing, tools used / Using tools to analyze webpack bundles
  • WEBPACK VISUALIZER
    • reference / How it works...
  • Web Workers
    • work on separate threads, performing / Performing work on separate threads with Web Workers, How to do it..., How it works...
    • messages, sending to / Sending messages to and from Web Workers, How it works...
    • messages, sending from / Sending messages to and from Web Workers, How it works...
    • data, sending to / Sending data to a Web Worker, How it works...
    • SharedArrayBuffer, sending to / Sending SharedArrayBuffer to a Web Worker, How it works...
    • SharedArray, reading from / How it works...
  • Windows
    • Node.js, installing with NVM / Installing Node.js with NVM: Windows, How it works...
  • workers
    • stopping, with terminate / Stopping workers with terminate, How it works...
  • wrapper class
    • creating, for Map / Creating a class that wraps Map to work with specific complex types, Creating a class that wraps a Set to work with more complex types, How it works...
    • creating, for WeakMap / Creating a class that uses WeakMap to work with specific complex types
  • wwebpack bundles
    • analyzing, tools used / How it works...
lock icon The rest of the chapter is locked
arrow left Previous Section
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £13.99/month. Cancel anytime
Visually different images