Skip to content

Commit 91547ee

Browse files
committed
Translate Callbacks' section Callback in callback
1 parent 3b7521d commit 91547ee

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

1-js/11-async/01-callbacks/article.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,29 +96,29 @@ Isso é chamado de programação assíncrona "baseada em callbacks". A função
9696

9797
Aqui nós fizemos isso em `loadScript`, mas é claro que isso é uma abordagem genérica.
9898

99-
## Callback in callback
99+
## Callback no callback
100100

101-
How can we load two scripts sequentially: the first one, and then the second one after it?
101+
Como poderíamos carregar dois scripts sequencialmente? Carregar um primeiro, e depois o segundo?
102102

103-
The natural solution would be to put the second `loadScript` call inside the callback, like this:
103+
A solução natural seria colocar a segunda chamada de `loadScript` dentro do callback, assim:
104104

105105
```js
106106
loadScript('/my/script.js', function(script) {
107107

108-
alert(`Cool, the ${script.src} is loaded, let's load one more`);
108+
alert(`Legal, ${script.src} foi carregado, vamos carregar mais um`);
109109

110110
*!*
111111
loadScript('/my/script2.js', function(script) {
112-
alert(`Cool, the second script is loaded`);
112+
alert(`Legal, o segundo script foi carregado`);
113113
});
114114
*/!*
115115

116116
});
117117
```
118118

119-
After the outer `loadScript` is complete, the callback initiates the inner one.
119+
Depois que o `loadScript` de fora termina, o callback inicia o `loadScript` de dentro.
120120

121-
What if we want one more script...?
121+
E se nós quisermos mais um script...?
122122

123123
```js
124124
loadScript('/my/script.js', function(script) {
@@ -127,7 +127,7 @@ loadScript('/my/script.js', function(script) {
127127

128128
*!*
129129
loadScript('/my/script3.js', function(script) {
130-
// ...continue after all scripts are loaded
130+
// ...continua depois que todo os scripts forem carregados
131131
});
132132
*/!*
133133

@@ -136,7 +136,7 @@ loadScript('/my/script.js', function(script) {
136136
});
137137
```
138138

139-
So, every new action is inside a callback. That's fine for few actions, but not good for many, so we'll see other variants soon.
139+
Então, toda ação nova fica dentro de um callback. Tudo bem para poucas ações, mas não é bom para muitas ações. Por isso nós vamos ver outras variantes em breve.
140140

141141
## Handling errors
142142

0 commit comments

Comments
 (0)