Function binding by diogoosz · Pull Request #484 · javascript-tutorial/pt.javascript.info
Repository navigation
Function binding - #484
Merged
gabifs merged 2 commits into javascript-tutorial:master from diogoosz:translate-function-binding Nov 21, 2026
Merged
Function binding #484 gabifs merged 2 commits into javascript-tutorial:master from diogoosz:translate-function-binding
Conversation
diogoosz commented Nov 9, 2026
Copy link Copy Markdown
Contributor
Tradução do artigo "Function binding" para o português, incluindo os exercícios.
Conforme comentado na #1 .
Translate "Function binding" article to Portuguese
088f311
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>gabifs reviewed Nov 12, 2026
View reviewed changes
Comment thread 1-js/06-advanced-functions/10-bind/6-ask-partial/solution.md
Outdated
|
|
||
|
|
||
| 1. Either use a wrapper function, an arrow to be concise : | ||
| 1. Ou use uma função de invólucro, uma função seta para ficar conciso : |
View reviewed changes
Comment thread 1-js/06-advanced-functions/10-bind/6-ask-partial/solution.md
|
|
||
| ```js | ||
| askPassword(() => user.login(true), () => user.login(false)); | ||
| ``` |
View reviewed changes
Comment thread 1-js/06-advanced-functions/10-bind/article.md
Outdated
| O método `setTimeout` , no navegador, é um pouco especial: ele define `this=window` para a chamada da função (para o Node.js, `this` se torna o objeto timer, mas isso não importa muito aqui ). Então, para `this.firstName` , ele tenta obter `window.firstName`, que não existe. Em outros casos parecidos, normalmente `this` simplesmente se torna `undefined`. | ||
|
|
||
| The task is quite typical -- we want to pass an object method somewhere else (here -- to the scheduler) where it will be called. How to make sure that it will be called in the right context ? | ||
| A tarefa é bem típica -- queremos passar um método de objeto para algum outro lugar (aqui -- para o agendador) onde ele vai ser chamado. Como garantir que ele vai ser chamado no contexto certo ? |
View reviewed changes
Comment thread 1-js/06-advanced-functions/10-bind/article.md
Outdated
| Por exemplo, temos uma função `send(from, to, text)`. Então, dentro de um objeto `user` , podemos querer usar uma variante parcial dela : `sendTo(to, text)` , que envia a partir do usuário atual . | ||
|
|
||
| ## Going partial without context | ||
| ## Indo parcial sem contexto |
View reviewed changes
Comment thread 1-js/06-advanced-functions/10-bind/article.md
Outdated
| Quando fixamos alguns argumentos de uma função existente, a função resultante (menos universal) é chamada de *parcialmente aplicada* ou *parcial *. | ||
|
|
||
| Partials are convenient when we don't want to repeat the same argument over and over again. Like if we have a `send(from, to)` function, and `from` should always be the same for our task, we can get a partial and go on with it . | ||
| Parciais são convenientes quando não queremos repetir o mesmo argumento o tempo todo. Tipo se temos uma função `send(from, to)` , e `from` deveria ser sempre o mesmo para a nossa tarefa, podemos obter uma parcial e seguir com ela . |
View reviewed changes
Comment thread 1-js/06-advanced-functions/10-bind/article.md
Outdated
| --- | ||
|
|
||
| # Function binding | ||
| # Vínculo de função |
Apply review feedback from @gabifs
5613067
- Standardize "função seta" -> "arrow function", matching the term used in the sibling 12-arrow-functions chapter - Fix ambiguous pronoun: "o executa" (agreed with masculine `user`, implying the object itself is called) -> "chama o método" - "A tarefa" -> "A situação" (avoids confusion with the chapter's own exercises, also called "tarefa") - "Indo parcial sem contexto" -> "Aplicação parcial sem contexto" (literal calque of "Going partial") - "Tipo se temos" -> "Por exemplo, se temos" (informal register) - Title: "Vínculo de função" -> "Vinculação de função", matching "vinculação"/"vinculação em massa" used in the body and the link text from <info:bind> in 09-classes/01-class Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
diogoosz commented Nov 21, 2026
Copy link Copy Markdown
Contributor
Author
|
Obrigado, @gabifs ! Apliquei tudo: "função seta"→"arrow function" (consistente com o capítulo 12-arrow-functions), corrigi o referente ambíguo em "o executa", "A tarefa"→"A situação", "Indo parcial"→"Aplicação parcial", removi o "Tipo se temos" coloquial, e o título "Vínculo de função"→"Vinculação de função" pra bater com o resto do texto e o link de info:bind em 09-classes/01-class. |
eae5b27
into
javascript-tutorial : master
Nov 21, 2026
1 check passed
Sign up for free
to join this conversation on GitHub .
Already have an account?
Sign in to comment