Skip to content

Commit a0b479d

Browse files
didostaptarasyyyk
andauthored
Promise (#160)
* bromise basics * Update 1-js/11-async/02-promise-basics/article.md * Update 1-js/11-async/02-promise-basics/article.md * Update 1-js/11-async/02-promise-basics/article.md * Update 1-js/11-async/02-promise-basics/article.md * Update 1-js/11-async/02-promise-basics/article.md * Remove unnecessary line * Update 1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html * Update 1-js/11-async/02-promise-basics/article.md * Update 1-js/11-async/02-promise-basics/article.md * Correct lines, remove unnecessary lines Co-authored-by: Taras <[email protected]>
1 parent 89ee8e9 commit a0b479d

File tree

7 files changed

+146
-146
lines changed

7 files changed

+146
-146
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
The output is: `1`.
1+
Результат буде: `1`.
22

3-
The second call to `resolve` is ignored, because only the first call of `reject/resolve` is taken into account. Further calls are ignored.
3+
Другий виклик `resolve` проігнорується, оскільки враховується тільки перший виклик `reject/resolve`. Всі наступні їхні виклики ігноруються.

1-js/11-async/02-promise-basics/01-re-resolve/task.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11

2-
# Re-resolve a promise?
2+
# Чи можливо "перевиконати" проміс?
33

44

5-
What's the output of the code below?
5+
Що виведе код нижче?
66

77
```js
88
let promise = new Promise(function(resolve, reject) {

1-js/11-async/02-promise-basics/02-delay-promise/solution.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ function delay(ms) {
33
return new Promise(resolve => setTimeout(resolve, ms));
44
}
55

6-
delay(3000).then(() => alert('runs after 3 seconds'));
6+
delay(3000).then(() => alert('виконалось через 3 секунди'));
77
```
88

9-
Please note that in this task `resolve` is called without arguments. We don't return any value from `delay`, just ensure the delay.
9+
Зауважте що `resolve` викликається без аргументів. Ми нічого не повертаємо з `delay`, просто гарантуємо затримку.
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11

2-
# Delay with a promise
2+
# Затримка на промісах
33

4-
The built-in function `setTimeout` uses callbacks. Create a promise-based alternative.
4+
Вбудована функція `setTimeout` використовує колбек-функції. Створіть альтернативу яка базується на промісах.
55

6-
The function `delay(ms)` should return a promise. That promise should resolve after `ms` milliseconds, so that we can add `.then` to it, like this:
6+
Функція `delay(ms)` повинна повертати проміс, який перейде в стан `resolved` через `ms` мілісекунд, так щоб ми могли додати до нього `.then`:
77

88
```js
99
function delay(ms) {
10-
// your code
10+
// ваш код
1111
}
1212

13-
delay(3000).then(() => alert('runs after 3 seconds'));
13+
delay(3000).then(() => alert('виконалось через 3 секунди'));
1414
```

1-js/11-async/02-promise-basics/03-animate-circle-promise/solution.view/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222

2323
<body>
2424

25-
<button onclick="go()">Click me</button>
25+
<button onclick="go()">Клацни на мене</button>
2626

2727
<script>
2828

2929
function go() {
3030
showCircle(150, 150, 100).then(div => {
3131
div.classList.add('message-ball');
32-
div.append("Hello, world!");
32+
div.append("Привіт, світ!");
3333
});
3434
}
3535

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11

2-
# Animated circle with promise
2+
# Анімація круга за допомогою проміса
33

4-
Rewrite the `showCircle` function in the solution of the task <info:task/animate-circle-callback> so that it returns a promise instead of accepting a callback.
4+
Перепишіть функцію `showCircle`, написану в завданні [Анімація круга за допомогою колбека]<info:task/animate-circle-callback> таким чином щоб вона повертала проміс, замість того щоб приймати в аргументи колбек-функцію.
55

6-
The new usage:
6+
Нове використання:
77

88
```js
99
showCircle(150, 150, 100).then(div => {
1010
div.classList.add('message-ball');
11-
div.append("Hello, world!");
11+
div.append("Привіт, світ!");
1212
});
1313
```
1414

15-
Take the solution of the task <info:task/animate-circle-callback> as the base.
15+
Візьміть за основу рішення з завдання [Анімація круга за допомогою колбека]<info:task/animate-circle-callback>.

0 commit comments

Comments
 (0)