Wrapping Up
Method synthesis is a way to add members to objects, at runtime, based on context and the current state of the object. Using this capability, you can enhance and alter the API and the behavior of objects, at runtime, far beyond the facilities offered by the author of a class. This powerful metaprogramming feature is now possible in JavaScript due to the addition of two classes: Reflect and Proxy. The Reflect class provides convenience methods to query for different metadata of a class. The Proxy class is an interceptor that can wrap around objects and manipulate interactions with the object. Decorators offer another way to do metaprogramming—when placed on a target, they are executed by the runtime to add predefined metadata and members ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access