Skip to content

Commit a9da95c

Browse files
author
Renato Vicente Frison dos Santos
committed
docs: translate "guide/migration/events-api.md"
1 parent 8e1c7a2 commit a9da95c

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/guide/migration/events-api.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ badges:
33
- breaking
44
---
55

6-
# Events API <MigrationBadges :badges="$frontmatter.badges" />
6+
# API de eventos <MigrationBadges :badges="$frontmatter.badges" />
77

8-
## Overview
8+
## Visão geral
99

10-
`$on`, `$off` and `$once` instance methods are removed. Application instances no longer implement the event emitter interface.
10+
Os métodos `$on`, `$off` e `$once` foram retirados da instancia. A instancia da aplicação não implementa mais a interface de emissor de eventos.
1111

12-
## 2.x Syntax
12+
## 2.x Sintaxe
1313

14-
In 2.x, Vue instance could be used to trigger handlers attached imperatively via the event emitter API (`$on`, `$off` and `$once`). This was used to create _event hubs_ to create global event listeners used across the whole application:
14+
Na 2.x, a instância Vue pode ser usada para acionar manipuladores anexados imperativamente por meio da API do emissor de eventos (`$on`,` $off` e `$once`). Isso foi usado para criar _event hubs_ para permitir a comunicação de eventos globais usados em todo o aplicativo:
1515

1616
```js
1717
// eventHub.js
@@ -29,7 +29,7 @@ export default {
2929
mounted() {
3030
// adding eventHub listener
3131
eventHub.$on('custom-event', () => {
32-
console.log('Custom event triggered!')
32+
console.log('Evento customizado disparado!')
3333
})
3434
},
3535
beforeDestroy() {
@@ -46,18 +46,18 @@ import eventHub from './eventHub'
4646
export default {
4747
methods: {
4848
callGlobalCustomEvent() {
49-
eventHub.$emit('custom-event') // if ChildComponent is mounted, we will have a message in the console
49+
eventHub.$emit('custom-event') // Quando o componente ChildComponent é montado, nós teremos uma mensagem no console
5050
}
5151
}
5252
}
5353
```
5454

55-
## 3.x Update
55+
## 3.x Atualização
5656

57-
We removed `$on`, `$off` and `$once` methods from the instance completely. `$emit` is still a part of the existing API as it's used to trigger event handlers declaratively attached by a parent component
57+
Removemos os métodos `$on`,`$off` e `$once` da instância completamente. `$emit` ainda é uma parte da API existente, pois é usado para acionar manipuladores de eventos declarativamente anexados por um componente pai.
5858

59-
## Migration Strategy
59+
## Estratégia de Migração
6060

61-
Existing event hubs can be replaced by using an external library implementing the event emitter interface, for example [mitt](https://github.com/developit/mitt) or [tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
61+
As comunicações por _event hubs_ existentes podem ser substituídos usando uma biblioteca externa implementando a interface do emissor de eventos, por exemplo [mitt](https://github.com/developit/mitt) ou [tiny-emitter](https://github.com/scottcorgan/tiny-emitter).
6262

63-
These methods can also be supported in compatibility builds.
63+
Esses métodos também podem ser suportados em compilações de compatibilidade.

0 commit comments

Comments
 (0)