© Raju Gandhi 2019
R. GandhiJavaScript Nexthttps://doi.org/10.1007/978-1-4842-5394-6_13

13. Metamorphosis with Proxy and Reflect

Raju Gandhi1 
(1)
Columbus, OH, USA
 

No API can or should attempt to be complete. Depending on the use-case, and the problem space, we often find that we may need to add, remove, or even constraint behavior to an object, or a type. Historically our approach to this was leveraging JavaScript’s dynamic nature, and simply tack on the additional behavior we wanted to see on any object. Symbols can help in this regard, by giving us the guarantee of collision-free keys. However, in many cases it can feel a tad hackish, especially when we do not wish to permanently modify behavior of an object for the lifetime of our application. ...

Get JavaScript Next: Your Complete Guide to the New Features Introduced in JavaScript, Starting from ES6 to ES9 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.