|
2 | 2 |
|
3 | 3 | 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.
|
4 | 4 |
|
5 |
| -Proxies are used in many libraries and some browser frameworks. We'll see many practical applications in this chapter. |
| 5 | +Proxies are used in many libraries and some browser frameworks. We'll see many practical applications in this article. |
6 | 6 |
|
7 | 7 | The syntax:
|
8 | 8 |
|
@@ -244,7 +244,7 @@ If we forget to do it or return any falsy value, the operation triggers `TypeErr
|
244 | 244 | Such methods differ in details:
|
245 | 245 | - `Object.getOwnPropertyNames(obj)` returns non-symbol keys.
|
246 | 246 | - `Object.getOwnPropertySymbols(obj)` returns symbol keys.
|
247 |
| -- `Object.keys/values()` returns non-symbol keys/values with `enumerable` flag (property flags were explained in the chapter <info:property-descriptors>). |
| 247 | +- `Object.keys/values()` returns non-symbol keys/values with `enumerable` flag (property flags were explained in the article <info:property-descriptors>). |
248 | 248 | - `for..in` loops over non-symbol keys with `enumerable` flag, and also prototype keys.
|
249 | 249 |
|
250 | 250 | ...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
|
446 | 446 | So, such a proxy shouldn't be used everywhere.
|
447 | 447 |
|
448 | 448 | ```smart header="Private properties of a class"
|
449 |
| -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. |
| 449 | +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. |
450 | 450 |
|
451 | 451 | Such properties have their own issues though. In particular, they are not inherited.
|
452 | 452 | ```
|
453 | 453 |
|
454 | 454 | ## "In range" with "has" trap
|
455 | 455 |
|
456 |
| -Let's see more examples. |
| 456 | +Let's see more examples.ar |
457 | 457 |
|
458 | 458 | We have a range object:
|
459 | 459 |
|
@@ -507,9 +507,9 @@ The `apply(target, thisArg, args)` trap handles calling a proxy as function:
|
507 | 507 | - `thisArg` is the value of `this`.
|
508 | 508 | - `args` is a list of arguments.
|
509 | 509 |
|
510 |
| -For example, let's recall `delay(f, ms)` decorator, that we did in the chapter <info:call-apply-decorators>. |
| 510 | +For example, let's recall `delay(f, ms)` decorator, that we did in the article <info:call-apply-decorators>. |
511 | 511 |
|
512 |
| -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. |
| 512 | +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. |
513 | 513 |
|
514 | 514 | Here's the previous, function-based implementation:
|
515 | 515 |
|
@@ -587,7 +587,7 @@ The result is the same, but now not only calls, but all operations on the proxy
|
587 | 587 |
|
588 | 588 | We've got a "richer" wrapper.
|
589 | 589 |
|
590 |
| -Other traps exist: the full list is in the beginning of this chapter. Their usage pattern is similar to the above. |
| 590 | +Other traps exist: the full list is in the beginning of this article. Their usage pattern is similar to the above. |
591 | 591 |
|
592 | 592 | ## Reflect
|
593 | 593 |
|
|
0 commit comments