fixes
This commit is contained in:
parent
585b77dbb9
commit
203b8f9f07
5 changed files with 10 additions and 10 deletions
|
@ -30,7 +30,7 @@ let animal = new Animal("My animal");
|
|||
...And `Rabbit`:
|
||||
|
||||
```js
|
||||
class Rabbit extends Animal {
|
||||
class Rabbit {
|
||||
constructor(name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
|
|
@ -273,7 +273,7 @@ The pattern is very common, it's not about users, but just about anything. For i
|
|||
What we'd like to have is an iterable source of commits, so that we could use it like this:
|
||||
|
||||
```js
|
||||
let repo = 'iliakan/javascript-tutorial-en'; // Github repository to get commits from
|
||||
let repo = 'javascript-tutorial/en.javascript.info'; // Github repository to get commits from
|
||||
|
||||
for await (let commit of fetchCommits(repo)) {
|
||||
// process commit
|
||||
|
@ -320,7 +320,7 @@ An example of use (shows commit authors in console):
|
|||
|
||||
let count = 0;
|
||||
|
||||
for await (const commit of fetchCommits('iliakan/javascript-tutorial-en')) {
|
||||
for await (const commit of fetchCommits('javascript-tutorial/en.javascript.info')) {
|
||||
|
||||
console.log(commit.author.login);
|
||||
|
||||
|
|
|
@ -57,7 +57,7 @@ To get the response body, we need to use an additional method call.
|
|||
For instance, here we get a JSON-object with latest commits from Github:
|
||||
|
||||
```js run async
|
||||
let response = await fetch('https://api.github.com/repos/iliakan/javascript-tutorial-en/commits');
|
||||
let response = await fetch('https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits');
|
||||
|
||||
*!*
|
||||
let commits = await response.json(); // read response body and parse as JSON
|
||||
|
@ -69,7 +69,7 @@ alert(commits[0].author.login);
|
|||
Or, the same using pure promises syntax:
|
||||
|
||||
```js run
|
||||
fetch('https://api.github.com/repos/iliakan/javascript-tutorial-en/commits')
|
||||
fetch('https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits')
|
||||
.then(response => response.json())
|
||||
.then(commits => alert(commits[0].author.login));
|
||||
```
|
||||
|
@ -119,7 +119,7 @@ There's a Map-like headers object in `response.headers`.
|
|||
We can get individual headers or iterate over them:
|
||||
|
||||
```js run async
|
||||
let response = await fetch('https://api.github.com/repos/iliakan/javascript-tutorial-en/commits');
|
||||
let response = await fetch('https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits');
|
||||
|
||||
// get one header
|
||||
alert(response.headers.get('Content-Type')); // application/json; charset=utf-8
|
||||
|
|
|
@ -39,7 +39,7 @@ Here's the full code to get response and log the progress, more explanations fol
|
|||
|
||||
```js run async
|
||||
// Step 1: start the fetch and obtain a reader
|
||||
let response = await fetch('https://api.github.com/repos/iliakan/javascript-tutorial-en/commits?per_page=100');
|
||||
let response = await fetch('https://api.github.com/repos/javascript-tutorial/en.javascript.info/commits?per_page=100');
|
||||
|
||||
const reader = response.body.getReader();
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@ See <https://github.com/javascript-tutorial/translate> for the details.
|
|||
|
||||
## Contributions
|
||||
|
||||
We'd also like to collaborate on the tutorial with other people.
|
||||
We'd also like to collaborate on the tutorial with other people.
|
||||
|
||||
Something's wrong? A topic is missing? Explain it to people, add as PR 👏
|
||||
|
||||
**You can edit the text in any editor.** The tutorial uses enhanced "markdown" format, easy to grasp. And if you want to see how it looks on-site, there's a server to run the tutorial locally at <https://github.com/iliakan/javascript-tutorial-server>.
|
||||
**You can edit the text in any editor.** The tutorial uses enhanced "markdown" format, easy to grasp. And if you want to see how it looks on-site, there's a server to run the tutorial locally at <https://github.com/javascript-tutorial/server>.
|
||||
|
||||
The list of contributors is available at <https://javascript.info/about#contributors>.
|
||||
|
||||
|
@ -36,4 +36,4 @@ It's very easy to add something new.
|
|||
|
||||
---
|
||||
💓
|
||||
Ilya Kantor
|
||||
Ilya Kantor @iliakan
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue