Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Introduction callbacks#133

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
nildo wants to merge9 commits intojavascript-tutorial:master
base:master
Choose a base branch
Loading
fromnildo:introduction-callbacks

Conversation

@nildo
Copy link

No description provided.

@CLAassistant
Copy link

CLAassistant commentedMay 18, 2020
edited
Loading

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign ourContributor License Agreement before we can accept your contribution.
2 out of3 committers have signed the CLA.

✅ nildo
✅ odsantos
❌ Nildo Júnior


Nildo Júnior seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, pleaseadd the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let usrecheck it.

@odsantos
Copy link
Contributor

Hi@nildo could you please resolve the conflicts? Thank you.

Copy link
Contributor

@odsantosodsantos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Hi@nildo please, have you tested the code (as much as possible) as the author suggests?
Not an imperative, but having time that might be helpful.

I hope that you might let me know if you don't agree with any change.

Thank you,
Osvaldo.

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@nildo
Copy link
Author

/done

Copy link
Contributor

@jonnathan-lsjonnathan-ls left a comment
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Olá@nildo, segue minha revisão!

```

Naturally, the browser probably didn't have time to load the script.So the immediate call to the new function fails. As of now, the`loadScript`function doesn't provide a way to track the load completion. The scriptloads and eventually runs, that's all. But we'd like to know when it happens, to use new functions and variables from that script.
Naturalmente, o navegador provavelmente não teve tempo de carregar o script.Então a chamada imediata para a nova função falha. Do jeito que está, a função`loadScript`não provê uma maneira de saber quando o carregamento termina. O scriptcarrega e eventualmente é executado, isso é tudo. Mas nós queremos saber quando isso acontece, para podermos usar as novas funções e variáveis daquele script.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sugestão de alteração:

  • Alterare eventualmente é executado parae é eventualmente executado.

image

Regra "Colocação de advérbio"

https://community.languagetool.org/rule/show/COLOCA%C3%87%C3%83O_ADV%C3%89RBIO?lang=pt

```

That's called a "callback-based" style of asynchronous programming. Afunction that does something asynchronously should provide a`callback`argument where we put the function to run after it's complete.
Isso é chamado de programação assíncrona "baseada em callbacks". Afunção que faz alguma coisa assincronamente deve prover um argumento`callback`onde nós colocamos a função que vai executar depois que ela estiver completa.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sugestão de alteração:

  • Alteraralguma coisa paraalgo.

image

Regra "2. Expressões prolixas"

https://community.languagetool.org/rule/show/PT_WORDINESS_REPLACE?lang=pt

```

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

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sugestão de alteração:

  • Alterardentro de paraem.

image

Regra "Dentro de/da(s)/do(s) > em/na(s)/no(s)"

https://community.languagetool.org/rule/show/DENTRO_DE_DA_DAS_DO_DOS_EM_NA_NAS_NO_NOS?lang=pt

##Tratando erros

In the above examples we didn't consider errors. What if the script loading fails? Our callbackshould be able to react on that.
No exemplo acima nós não consideramos erros. E se o carregamento do script falhar? Nosso callbackdeveria ser capaz de reagir a isso.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sugestão de alteração:

  • Alterarser capaz de paraconseguir.

image

Regra "Ser capaz de → Conseguir"

https://community.languagetool.org/rule/show/SER_CAPAZ_DE_CONSEGUIR?lang=pt

A "pirâmide" de chamadas aninhadas cresce para a direita a cada ação assíncrona e rapidamente sai do controle.

So this way of coding isn't very good.
Então esse jeito de programar não é muito bom.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sugestão de alteração:

  • Alterarmuito bom parabom.

image

Regra "2. Expressões prolixas"

https://community.languagetool.org/rule/show/PT_WORDINESS_REPLACE?lang=pt

Viu? Isso faz a mesma coisa, e não tem aninhamento profundo agora porque nós transformamos cada ação em uma função de nível superior separada.

It works, but the code looks like a torn apart spreadsheet. It's difficult to read, and you probably noticed that one needs to eye-jump between pieces while reading it. That's inconvenient, especially if the reader is not familiar with the code and doesn't know where to eye-jump.
Funciona, porém o código parece uma planilha dividida. É difícil de ler, e você provavelmente percebeu que precisamos de pular entre as partes do código enquanto estamos lendo ele. Isso é inconveniente, especialmente se o leitor não estiver familiarizado com o código e não souber para onde pular.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Sugestão de alteração:

  • Adicionar virgula após a locuçãoporém.

image

Regra "Locuções entre vírgulas: portanto, por exemplo, na verdade"

https://community.languagetool.org/rule/show/VERB_COMMA_CONJUNCTION?lang=pt

@javascript-translate-bot

Please make the requested changes. After it, add a comment "/done".
Then I'll ask for a new review 👻

@odsantos
Copy link
Contributor

Hi@nildo , the English article was updated and this PR has conflicts. Thanks.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@jonnathan-lsjonnathan-lsjonnathan-ls requested changes

@odsantosodsantosAwaiting requested review from odsantos

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@nildo@CLAassistant@odsantos@javascript-translate-bot@jonnathan-ls

[8]ページ先頭

©2009-2025 Movatter.jp