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

Export and import#121

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

Merged
wnleao merged 1 commit intojavascript-tutorial:masterfromanapaulalemos:master
May 13, 2020
Merged

Export and import#121

wnleao merged 1 commit intojavascript-tutorial:masterfromanapaulalemos:master
May 13, 2020

Conversation

anapaulalemos
Copy link
Contributor

No description provided.

@CLAassistant
Copy link

CLAassistant commentedMay 7, 2020
edited
Loading

CLA assistant check
All committers have signed the CLA.

@wnleao
Copy link
Contributor

wnleao commentedMay 9, 2020
edited
Loading

Hey, Ana! Could you join all commits in only 1?

@wnleao
Copy link
Contributor

wnleao commentedMay 9, 2020
edited
Loading

Btw, did you check if the english version had changes? Some pt-br articles are way back...https://github.com/javascript-tutorial/en.javascript.info

@anapaulalemos
Copy link
ContributorAuthor

anapaulalemos commentedMay 9, 2020
edited
Loading

Hey, Ana! Could you join all commits in only 1?

Of course! No problem.

Btw, did you check if the english version had changes? Some pt-br articles are way back...https://github.com/javascript-tutorial/en.javascript.info

I didn't, to be honest. But I'll check that and the above comment and return, okay?

@wnleao
Copy link
Contributor

Hey, Ana! Could you join all commits in only 1?

Of course! No problem.

Btw, did you check if the english version had changes? Some pt-br articles are way back...https://github.com/javascript-tutorial/en.javascript.info

I didn't, to be honest. But I'll check that and the above comment and return, okay?

No problem! Let me know when you're done and I'll review your PR.

@anapaulalemos
Copy link
ContributorAuthor

No problem! Let me know when you're done and I'll review your PR.

It's done. Thank you!

@wnleao
Copy link
Contributor

wnleao commentedMay 9, 2020
edited
Loading

No problem! Let me know when you're done and I'll review your PR.

It's done. Thank you!

Right! I'll review it. Wouldn't you like to become a maintainer? Ask iliakan in an issue in the main repository and he will grant you permission.

@wnleao
Copy link
Contributor

Ana, in your commit there is a change to 1-js/01-getting-started/2-manuals-and-specifications/article.md → 1-js/01-getting-started/2-manuals-specifications/article.md. Could you remove it? I think you added it by mistake.

#Export e Import

#Exportand Import
As diretivasExporte import tem diversas variantes de sintaxe.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we leave export in lowercase aswell?

anapaulalemos reacted with thumbs up emoji
import {sayHi} from './say.js';
```
...Then the optimizer will automatically detect it and totally remove the other functions from the bundled code, thus making thebuildsmaller.That is called"tree-shaking".
...Então o otimizador vai ver isso e remover as outras funções nã utilizadas nó código, tornando obuildmenor.Isso é chamado de"tree-shaking".
Copy link
Contributor

Choose a reason for hiding this comment

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

There're two minor typos "nã" and "nó" código.

anapaulalemos reacted with thumbs up emoji
import {sayHi} from './say.js';
```
...Then the optimizer will automatically detect it and totally remove the other functions from the bundled code, thus making thebuildsmaller.That is called"tree-shaking".
...Então o otimizador vai ver isso e remover as outras funções nã utilizadas nó código, tornando obuildmenor.Isso é chamado de"tree-shaking".
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing the "from the bundled code" part.

anapaulalemos reacted with thumbs up emoji
2.Explicitly listing what toimport gives shorter names:`sayHi()`instead of`lib.sayHi()`.
3.Explicit imports give better overviewof the code structure: what is used andwhere.It makes code support and refactoring easier.
2.Listar explicitamente o que importar nos fornece nomes mais curtos:`sayHi()`ao invés de`say.sayHi()`.
3.Uma lista explícitado que importar fornecem uma visão geral melhor da estruturado código: o que é usado eonde.Torna o código fácil de prover suporte e de refatorar.
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor typo: "Uma lista ... fornece" and not "fornecem".

anapaulalemos reacted with thumbs up emoji
```

Importswithout curly braces looknicer.A common mistake when starting to use modules is to forget curly braces atall.So, remember,`import`needs curly bracesfor named imports and doesn't need them for the default one.
Importssem chaves parecem mais agradáveis.Um erro comum quando se começa a usar módulos é esquecer daschaves.Então, lembre-se,`import`precisa de chaves paraimport nomeados e não precisa para os importsdefault.
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe it would be better to use "imports nomeados (named imports)". What do you think?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I agree with that.

Membros da mesma equipe podem usar nomes diferentes para importar a mesma coisa, e isso não é bom.

Usually, to avoid that and keep the code consistent, there's a rule that imported variables should correspond to file names, e.g:
Geralmente, para evitar isso e manter o código consistente, existe uma regra que as variáveis importadas deve corresponder ao nome dos arquivos, por exemplo:
Copy link
Contributor

Choose a reason for hiding this comment

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

minor typo: "variáveis importadas deve" -> "variáveis importadas devem"

anapaulalemos reacted with thumbs up emoji
```

Another solution would be to use namedexportseverywhere. Even if only a single thing is exported, it's still exported under a name, without`default`.
Ainda assim, algumas equipes consideram isso uma séria desvantagem dosexportsdefault.Então, eles preferem usar sempreexports comnomes.Mesmo se apenas uma coisa é exportada, ele ainda será exportada com um nome, sem`default`.
Copy link
Contributor

Choose a reason for hiding this comment

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

should it not be "ela ainda será" ?

anapaulalemos reacted with thumbs up emoji
A ideia é que os desenvolvedores que utilizarem nosso pacote não possam interferir na sua estrutura interna. Eles não devem procurar por arquivos dentro da pasta do nosso pacote. Apenas exportamos o que for necessário no`auth/index.js`e mantemos o resto escondido de olhos curiosos.

Now, asthe actual exported functionality is scattered among the package, we can gather and "re-export" it in`auth/index.js`:
Como asfuncionalidade exportadas estão espalhadas pelo pacote, podemos importá-las em`auth /index.js` e exportá-las neles:
Copy link
Contributor

Choose a reason for hiding this comment

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

minor typo: "exportá-las neles" -> "exportá-las nele"

anapaulalemos reacted with thumbs up emoji
```

...But what if we really need to import something conditionally? Or at the right time? Like, load a module upon request, when it's really needed?
... Mas e se realmente precisarmos importar algo condicionalmente? Ou na hora certa? Como carregar um módulo mediante solicitação, quando é realmente necessário?
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you missed a comma after "Como". With a comma, the following becomes an example rather than a question How.

anapaulalemos reacted with thumbs up emoji
@javascript-translate-bot

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

@anapaulalemos
Copy link
ContributorAuthor

/done

@wnleao
Copy link
Contributor

Great! Nice work :) could you review a quick one:#122 I just added a missing article from the english version. And also, could you review#120 ? Thank you!

@wnleaownleao mentioned this pull requestMay 10, 2020
@anapaulalemos
Copy link
ContributorAuthor

Great! Nice work :) could you review a quick one:#122 I just added a missing article from the english version. And also, could you review#120 ? Thank you!

Thank you! And, for sure, I'll take a look at both :)

#Export e Import

#Export and Import
As diretivas export e import tem diversas variantes de sintaxe.
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, Ana, I missed this one: "As diretivas ... têm" <- circumflex

@javascript-translate-bot

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

@anapaulalemos
Copy link
ContributorAuthor

/done

@wnleaownleao merged commit817a0f1 intojavascript-tutorial:masterMay 13, 2020
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@wnleaownleaownleao approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@anapaulalemos@CLAassistant@wnleao@javascript-translate-bot

[8]ページ先頭

©2009-2025 Movatter.jp