Skip to content

Commit

Permalink
Fix mistake in ch.7
Browse files Browse the repository at this point in the history
This is the `revocable` function that returns *proxy* and *revoke*.
  • Loading branch information
mallowigi committed May 14, 2015
1 parent a38b71c commit b37b885
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion es6 & beyond/ch7.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ pobj.a;

A revocable proxy is created with `Proxy.revocable(..)`, which is a regular function, not a constructor like `Proxy(..)`. Otherwise, it takes the same two arguments: *target* and *handlers*.

The return value of `Proxy.revoke(..)` is not the proxy itself as with `new Proxy(..)`. Instead, it's an object with two properties: *proxy* and *revoke* -- we used object destructuring (see "Destructuring" in Chapter 2) to assign these properties to `pobj` and `prevoke()` variables, respectively.
The return value of `Proxy.revocable(..)` is not the proxy itself as with `new Proxy(..)`. Instead, it's an object with two properties: *proxy* and *revoke* -- we used object destructuring (see "Destructuring" in Chapter 2) to assign these properties to `pobj` and `prevoke()` variables, respectively.

Once a revocable proxy is revoked, any attempts to access it (trigger any of its traps) will throw a `TypeError`.

Expand Down

0 comments on commit b37b885

Please sign in to comment.