Skip to content

Commit 1787914

Browse files
authored
Merge pull request #288 from cortizg/es.javascript.info.1-11-02-p
Promise
2 parents fcd3181 + e18293e commit 1787914

File tree

7 files changed

+141
-141
lines changed

7 files changed

+141
-141
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+
La salida es: `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+
La segunda llamada a 'resolve' se ignora, porque solo se tiene en cuenta la primera llamada de 'reject/resolve'. Otras llamadas son ignoradas.

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+
# ¿Volver a resolver una promesa?
33

44

5-
What's the output of the code below?
5+
¿Cuál es el resultado del código a continuación?
66

77
```js
88
let promise = new Promise(function(resolve, reject) {
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+
# Demora con una promesa
33

4-
The built-in function `setTimeout` uses callbacks. Create a promise-based alternative.
4+
La función incorporada `setTimeout` utiliza callbacks. Crea una alternativa basada en promesas.
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+
La función `delay(ms)` debería devolver una promesa. Esa promesa debería resolverse después de `ms` milisegundos, para que podamos agregarle `.then`, así:
77

88
```js
99
function delay(ms) {
10-
// your code
10+
// tu código
1111
}
1212

13-
delay(3000).then(() => alert('runs after 3 seconds'));
13+
delay(3000).then(() => alert('se ejecuta después de 3 segundos'));
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()">Haz clic</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("Hola, mundo!");
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+
# Círculo animado con promesa
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+
Vuelva a escribir la función `showCircle` en la solución de la tarea <info:task/animate-circle-callback> para que devuelva una promesa en lugar de aceptar un callback.
55

6-
The new usage:
6+
Nueva forma de uso:
77

88
```js
99
showCircle(150, 150, 100).then(div => {
1010
div.classList.add('message-ball');
11-
div.append("Hello, world!");
11+
div.append("Hola, mundo!");
1212
});
1313
```
1414

15-
Take the solution of the task <info:task/animate-circle-callback> as the base.
15+
Tome la solución de la tarea <info:task/animate-circle-callback> como base.

1-js/11-async/02-promise-basics/article.md

Lines changed: 124 additions & 124 deletions
Large diffs are not rendered by default.

1-js/11-async/02-promise-basics/head.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
script.src = src;
66

77
script.onload = () => resolve(script);
8-
script.onerror = () => reject(new Error("Script load error: " + src));
8+
script.onerror = () => reject(new Error("Error de carga de script: " + src));
99

1010
document.head.append(script);
1111
});

0 commit comments

Comments
 (0)