Upgrade to Pro — share decks privately, control downloads, hide ads and more …

es6 proxy overview

es6 proxy overview

Joe Wang

April 26, 2018
Tweet

More Decks by Joe Wang

Other Decks in Programming

Transcript

  1. WHAT IS PROXY PROXY IN JAVASCRIPT The Proxy object is

    used to define custom behavior for fundamental operations (e.g. property lookup, assignment, enumeration, function invocation, etc)
  2. WHAT IS PROXY PROXY IN JAVASCRIPT handler.apply() handler.construct() handler.defineProperty() handler.deleteProperty()

    handler.get() handler.getOwnPropertyDescriptor () handler.getPrototypeOf() handler.has() handler.isExtensible() handler.ownKeys() handler.preventExtensions() handler.set() handler.setPrototypeOf()
  3. SUMMARY PROS & CONS ▸ Expando property access ▸ Low

    coupling ▸ Protect the original object ▸ Meta programming in a way ▸ Browser compatibility