Skip to content

Commit d04ff3f

Browse files
committed
Merge branch 'master' of github.com:javascript-tutorial/en.javascript.info into sync-fe571b36
2 parents d658c96 + fe571b3 commit d04ff3f

File tree

5 files changed

+9
-15
lines changed

5 files changed

+9
-15
lines changed

1-js/06-advanced-functions/03-closure/article.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ We already know that a function can access variables outside of it ("outer" vari
77

88
But what happens if outer variables change since a function is created? Will the function get newer values or the old ones?
99

10-
And if a function is passed along as a parameter and called from another place of code, will it get access to outer variables at the new place?
10+
And what if a function is passed along as a parameter and called from another place of code, will it get access to outer variables at the new place?
1111

1212
Let's expand our knowledge to understand these scenarios and more complex ones.
1313

1-js/99-js-misc/04-reference-type/article.md

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,3 @@ That's for the subsequent method call `()` to get the object and set `this` to i
106106
For all other operations, the reference type automatically becomes the property value (a function in our case).
107107

108108
The whole mechanics is hidden from our eyes. It only matters in subtle cases, such as when a method is obtained dynamically from the object, using an expression.
109-
110-
111-
112-
113-
114-
result of dot `.` isn't actually a method, but a value of `` needs a way to pass the information about `obj`

2-ui/1-document/11-coordinates/article.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ As you can see, `left/top` do not equal `x/y` in such case.
8888
In practice though, `elem.getBoundingClientRect()` always returns positive width/height, here we mention negative `width/height` only for you to understand why these seemingly duplicate properties are not actually duplicates.
8989
```
9090
91-
```warn header="Internet Explorer and Edge: no support for `x/y`"
92-
Internet Explorer and Edge don't support `x/y` properties for historical reasons.
91+
```warn header="Internet Explorer: no support for `x/y`"
92+
Internet Explorer doesn't support `x/y` properties for historical reasons.
9393
9494
So we can either make a polyfill (add getters in `DomRect.prototype`) or just use `top/left`, as they are always the same as `x/y` for positive `width/height`, in particular in the result of `elem.getBoundingClientRect()`.
9595
```

5-network/01-fetch/01-fetch-users/solution.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ To fetch a user we need: `fetch('https://api.github.com/users/USERNAME')`.
33

44
If the response has status `200`, call `.json()` to read the JS object.
55

6-
Otherwise, if a `fetch` fails, or the response has non-200 status, we just return `null` in the resulting arrray.
6+
Otherwise, if a `fetch` fails, or the response has non-200 status, we just return `null` in the resulting array.
77

88
So here's the code:
99

5-network/06-fetch-api/article.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ window.onunload = function() {
215215

216216
Normally, when a document is unloaded, all associated network requests are aborted. But `keepalive` option tells the browser to perform the request in background, even after it leaves the page. So this option is essential for our request to succeed.
217217

218-
It has few limitations:
218+
It has a few limitations:
219219

220220
- We can't send megabytes: the body limit for `keepalive` requests is 64kb.
221-
- If gather more data, we can send it out regularly in packets, so that there won't be a lot left for the last `onunload` request.
222-
- The limit is for all currently ongoing requests. So we can't cheat it by creating 100 requests, each 64kb.
223-
- We can't handle the server response if the request is made in `onunload`, because the document is already unloaded at that time, functions won't work.
224-
- Usually, the server sends empty response to such requests, so it's not a problem.
221+
- If we need to gather a lot of statistics about the visit, we should send it out regularly in packets, so that there won't be a lot left for the last `onunload` request.
222+
- This limit applies to all `keepalive` requests together. In other words, we can perform multiple `keepalive` requests in parallel, but the sum of their body lengths should not exceed 64kb.
223+
- We can't handle the server response if the document is unloaded. So in our example `fetch` will succeed due to `keepalive`, but subsequent functions won't work.
224+
- In most cases, such as sending out statistics, it's not a problem, as server just accepts the data and usually sends an empty response to such requests.

0 commit comments

Comments
 (0)