Skip to content

Commit 0e74c27

Browse files
authored
Merge pull request #135 from n-makoto/translate-migration-guide-events-api
Migration Guide > Events API の翻訳
2 parents 42c83e9 + 58c0a38 commit 0e74c27

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/guide/migration/events-api.md

Lines changed: 16 additions & 16 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 <MigrationBadges :badges="$frontmatter.badges" />
77

8-
## Overview
8+
## 概要
99

10-
`$on`, `$off` and `$once` instance methods are removed. Application instances no longer implement the event emitter interface.
10+
インスタンスメソッド`$on``$off``$once`は削除されました。アプリケーションインスタンスはイベントエミッタインタフェースを実装しなくなりました。
1111

12-
## 2.x Syntax
12+
## 2.x での構文
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+
2.x では、Vue インスタンスを使用して、イベントエミッタ API (`$on``$off``$once`) を介して強制的に接続されたハンドラをトリガすることができました。これは、アプリケーション全体で使用されるグローバルイベントリスナーを作成するための _イベントハブ_ を作るために使用されました。
1515

1616
```js
1717
// eventHub.js
@@ -27,15 +27,15 @@ import eventHub from './eventHub'
2727

2828
export default {
2929
mounted() {
30-
// adding eventHub listener
30+
// eventHub リスナーの追加
3131
eventHub.$on('custom-event', () => {
3232
console.log('Custom event triggered!')
3333
})
3434
},
3535
beforeDestroy() {
36-
// removing eventHub listener
36+
// eventHub リスナーの削除
3737
eventHub.$off('custom-event')
38-
}
38+
},
3939
}
4040
```
4141

@@ -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
50-
}
51-
}
49+
eventHub.$emit('custom-event') // ChildComponent がマウントされている場合、コンソールにメッセージが表示されます。
50+
},
51+
},
5252
}
5353
```
5454

55-
## 3.x Update
55+
## 3.x での更新
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+
インスタンスから`$on``$off``$once`メソッドを完全に削除しました。`$emit`は、親コンポーネントによって宣言的にアタッチされたイベントハンドラをトリガするために使用されるので、まだ既存の API の一部です。
5858

59-
## Migration Strategy
59+
## 移行の戦略
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).
61+
既存のイベントハブは、イベントエミッタインタフェースを実装した外部ライブラリ、例えば [mitt](https://github.com/developit/mitt) を使用して置き換えることができます。
6262

63-
These methods can also be supported in compatibility builds.
63+
これらのメソッドは互換性のあるビルドでもサポートされています。

0 commit comments

Comments
 (0)