-
Notifications
You must be signed in to change notification settings - Fork 182
Promise #160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
tarasyyyk
merged 11 commits into
javascript-tutorial:master
from
didostap:promise-basics
Aug 3, 2021
Merged
Promise #160
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
7148f00
bromise basics
didostap b283141
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk a639797
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk 2fd1075
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk 362b34b
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk 5c61fe3
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk 12d1159
Remove unnecessary line
tarasyyyk 4461dc1
Update 1-js/11-async/02-promise-basics/03-animate-circle-promise/solu…
tarasyyyk 68bbd0d
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk ef7b1e8
Update 1-js/11-async/02-promise-basics/article.md
tarasyyyk 027693e
Correct lines, remove unnecessary lines
tarasyyyk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
The output is: `1`. | ||
Результат буде: `1`. | ||
|
||
The second call to `resolve` is ignored, because only the first call of `reject/resolve` is taken into account. Further calls are ignored. | ||
Другий виклик `resolve` проігнорується, оскільки враховується тільки перший виклик `reject/resolve`. Всі наступні їхні виклики ігноруються. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
|
||
# Delay with a promise | ||
# Затримка на промісах | ||
|
||
The built-in function `setTimeout` uses callbacks. Create a promise-based alternative. | ||
Вбудована функція `setTimeout` використовує колбек-функції. Створіть альтернативу яка базується на промісах. | ||
|
||
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: | ||
|
||
Функція `delay(ms)` повинна повертати проміс, який перейде в стан `resolved` через `ms` мілісекунд, так щоб ми могли додати до нього `.then`: | ||
|
||
```js | ||
function delay(ms) { | ||
// your code | ||
// ваш код | ||
} | ||
|
||
delay(3000).then(() => alert('runs after 3 seconds')); | ||
delay(3000).then(() => alert('виконалось через 3 секунди')); | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
1-js/11-async/02-promise-basics/03-animate-circle-promise/task.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
|
||
# Animated circle with promise | ||
# Анімація круга за допомогою проміса | ||
|
||
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. | ||
Перепишіть функцію `showCircle`, написану в завданні [Анімація круга за допомогою колбека]<info:task/animate-circle-callback> таким чином щоб вона повертала проміс, замість того щоб приймати в аргументи колбек-функцію. | ||
|
||
The new usage: | ||
Нове використання: | ||
|
||
```js | ||
showCircle(150, 150, 100).then(div => { | ||
div.classList.add('message-ball'); | ||
div.append("Hello, world!"); | ||
div.append("Привіт, світ!"); | ||
}); | ||
``` | ||
|
||
Take the solution of the task <info:task/animate-circle-callback> as the base. | ||
Візьміть за основу рішення з завдання [Анімація круга за допомогою колбека]<info:task/animate-circle-callback>. |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.