Update article.md

"chapter" -> "article" (6 times or so)

I believe that is consistent with the agreed-upon terminology.
This commit is contained in:
Peter Roche 2020-02-08 20:44:59 -07:00 committed by GitHub
parent 2fee345f6e
commit fd0d378f0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
A `Proxy` object wraps another object and intercepts operations, like reading/writing properties and others, optionally handling them on its own, or transparently allowing the object to handle them.
Proxies are used in many libraries and some browser frameworks. We'll see many practical applications in this chapter.
Proxies are used in many libraries and some browser frameworks. We'll see many practical applications in this article.
The syntax:
@ -244,7 +244,7 @@ If we forget to do it or return any falsy value, the operation triggers `TypeErr
Such methods differ in details:
- `Object.getOwnPropertyNames(obj)` returns non-symbol keys.
- `Object.getOwnPropertySymbols(obj)` returns symbol keys.
- `Object.keys/values()` returns non-symbol keys/values with `enumerable` flag (property flags were explained in the chapter <info:property-descriptors>).
- `Object.keys/values()` returns non-symbol keys/values with `enumerable` flag (property flags were explained in the article <info:property-descriptors>).
- `for..in` loops over non-symbol keys with `enumerable` flag, and also prototype keys.
...But all of them start with that list.
@ -446,14 +446,14 @@ Besides, an object may be proxied multiple times (multiple proxies may add diffe
So, such a proxy shouldn't be used everywhere.
```smart header="Private properties of a class"
Modern JavaScript engines natively support private properties in classes, prefixed with `#`. They are described in the chapter <info:private-protected-properties-methods>. No proxies required.
Modern JavaScript engines natively support private properties in classes, prefixed with `#`. They are described in the article <info:private-protected-properties-methods>. No proxies required.
Such properties have their own issues though. In particular, they are not inherited.
```
## "In range" with "has" trap
Let's see more examples.
Let's see more examples.ar
We have a range object:
@ -507,9 +507,9 @@ The `apply(target, thisArg, args)` trap handles calling a proxy as function:
- `thisArg` is the value of `this`.
- `args` is a list of arguments.
For example, let's recall `delay(f, ms)` decorator, that we did in the chapter <info:call-apply-decorators>.
For example, let's recall `delay(f, ms)` decorator, that we did in the article <info:call-apply-decorators>.
In that chapter we did it without proxies. A call to `delay(f, ms)` returned a function that forwards all calls to `f` after `ms` milliseconds.
In that article we did it without proxies. A call to `delay(f, ms)` returned a function that forwards all calls to `f` after `ms` milliseconds.
Here's the previous, function-based implementation:
@ -587,7 +587,7 @@ The result is the same, but now not only calls, but all operations on the proxy
We've got a "richer" wrapper.
Other traps exist: the full list is in the beginning of this chapter. Their usage pattern is similar to the above.
Other traps exist: the full list is in the beginning of this article. Their usage pattern is similar to the above.
## Reflect