Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions 1-js/11-async/02-promise-basics/01-re-resolve/solution.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
The output is: `1`.
A saída é: `1`.

The second call to `resolve` is ignored, because only the first call of `reject/resolve` is taken into account. Further calls are ignored.
A segunda chamada a `resolve` é ignorada, porque só a primeira chamada de `reject/resolve` é levada em conta. As chamadas seguintes são ignoradas.
4 changes: 2 additions & 2 deletions 1-js/11-async/02-promise-basics/01-re-resolve/task.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

# Re-resolve a promise?
# Resolver uma promessa de novo?


What's the output of the code below?
Qual é a saída do código abaixo?

```js
let promise = new Promise(function(resolve, reject) {
Expand Down
4 changes: 2 additions & 2 deletions 1-js/11-async/02-promise-basics/02-delay-promise/solution.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ function delay(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

delay(3000).then(() => alert('runs after 3 seconds'));
delay(3000).then(() => alert('roda depois de 3 segundos'));
```

Please note that in this task `resolve` is called without arguments. We don't return any value from `delay`, just ensure the delay.
Repare que, nessa tarefa, `resolve` é chamado sem argumentos. Não retornamos nenhum valor de `delay`, só garantimos o atraso.
10 changes: 5 additions & 5 deletions 1-js/11-async/02-promise-basics/02-delay-promise/task.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

# Delay with a promise
# Atraso com uma promessa

The built-in function `setTimeout` uses callbacks. Create a promise-based alternative.
A função nativa `setTimeout` usa callbacks. Crie uma alternativa baseada em promessa.

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:
A função `delay(ms)` deve retornar uma promessa. Essa promessa deve ser resolvida depois de `ms` milissegundos, de forma que possamos adicionar `.then` a ela, assim:

```js
function delay(ms) {
// your code
// seu código
}

delay(3000).then(() => alert('runs after 3 seconds'));
delay(3000).then(() => alert('roda depois de 3 segundos'));
```
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

# Animated circle with promise
# Círculo animado com promessa

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.
Reescreva a função `showCircle`, da solução da tarefa <info:task/animate-circle-callback>, para que ela retorne uma promessa em vez de receber um callback.

The new usage:
O novo uso:

```js
showCircle(150, 150, 100).then(div => {
Expand All @@ -12,4 +12,4 @@ showCircle(150, 150, 100).then(div => {
});
```

Take the solution of the task <info:task/animate-circle-callback> as the base.
Use a solução da tarefa <info:task/animate-circle-callback> como base.
Loading