|
1 | 1 | ---
|
2 |
| -title: Migration from Vuex 0.6.x to 1.0 |
| 2 | +title: Migrasi dari Vuex 0.6.x ke 1.0 |
3 | 3 | type: guide
|
4 | 4 | order: 703
|
5 | 5 | ---
|
6 | 6 |
|
7 |
| -> Vuex 2.0 is released, but this guide only covers the migration to 1.0? Is that a typo? Also, it looks like Vuex 1.0 and 2.0 were released simultaneously. What's going on? Which one should I use and what's compatible with Vue 2.0? |
8 | 7 |
|
9 |
| -Both Vuex 1.0 and 2.0: |
| 8 | +> Vuex 2.0 sudah di-release, tapi kenapa petunjuk ini hanya mencakup migrasi ke 1.0? Apakah itu typo? Dan sepertinya Vuex 1.0 dan 2.0 di-release bersamaan. Apa yang terjadi? Yang mana yang harus saya pakai dan apa saja yang cocok dengan Vue 2.0? |
10 | 9 |
|
11 |
| -- fully support both Vue 1.0 and 2.0 |
12 |
| -- will be maintained for the foreseeable future |
| 10 | +Baik Vuex 1.0 atau 2.0 sama-sama: |
13 | 11 |
|
14 |
| -They have slightly different target users however. |
| 12 | +- secara penuh mendukung Vue 1.0 dan 2.0 |
| 13 | +- akan dimaintain untuk waktu yang terjangkau |
15 | 14 |
|
16 |
| -__Vuex 2.0__ is a radical redesign and simplification of the API, for those who are starting new projects or want to be on the cutting edge of client-side state management. __It is not covered by this migration guide__, so you should check out [the Vuex 2.0 docs](https://vuex.vuejs.org/en/index.html) if you'd like to learn more about it. |
| 15 | +Namun keduanya memiliki sedikit perbedaan pada target pengguna. |
17 | 16 |
|
18 |
| -__Vuex 1.0__ is mostly backwards-compatible, so requires very few changes to upgrade. It is recommended for those with large existing codebases or who want the smoothest possible upgrade path to Vue 2.0. This guide is dedicated to facilitating that process, but only includes migration notes. For the complete usage guide, see [the Vuex 1.0 docs](https://github.com/vuejs/vuex/tree/1.0/docs/en). |
| 17 | +__Vuex 2.0__ berisi perubahan radikal terhadap desain dan simplifikasi API, untuk mereka yang memulai proyek baru atau ingin performa yang lebih baik dalam manajemen *state* di sisi client. __ Hal tersebut tidak dibahas dalam petunjuk migrasi ini__, jadi Anda harus mengecek [the Vuex 2.0 docs](https://vuex.vuejs.org/en/index.html) jika Anda ingin mempelajarinya lebih lanjut. |
19 | 18 |
|
20 |
| -## `store.watch` with String Property Path <sup>replaced</sup> |
21 | 19 |
|
22 |
| -`store.watch` now only accept functions. So for example, you would have to replace: |
| 20 | +Kebanyakan API __Vuex 1.0__ sudah kompatibel kebelakang, jadi hanya butuh sedkit perubahan untuk melakukan *upgrade*. __Vuex 1.0__ direkomendasikan untuk mereka yang memiliki basis kode yang besar atau mereka yang ingin -*upgrade* ke Vue 2.0 dengan proses yang lebih mulus. Petunjuk ini didedikasikan untuk memfasilitasi proses tersebut, namun hanya mencantumkan catatan migrasi. Untuk petunjuk penggunaan yang lebih lengkap, lihat [the Vuex 1.0 docs](https://github.com/vuejs/vuex/tree/1.0/docs/en). |
| 21 | + |
| 22 | + |
| 23 | +## `store.watch` dengan Properti String Path <sup>diganti</sup> |
| 24 | + |
| 25 | +`store.watch` sekarang hanya menerima fungsi. Sebagai contoh, Anda harus mengganti: |
23 | 26 |
|
24 | 27 | ``` js
|
25 | 28 | store.watch('user.notifications', callback)
|
26 | 29 | ```
|
27 | 30 |
|
28 |
| -with: |
| 31 | +dengan: |
29 | 32 |
|
30 | 33 | ``` js
|
31 | 34 | store.watch(
|
32 |
| - // When the returned result changes... |
| 35 | + // Saat hasil yang dikembalikan berganti... |
33 | 36 | function (state) {
|
34 | 37 | return state.user.notifications
|
35 | 38 | },
|
36 |
| - // Run this callback |
| 39 | + // Jalankan callback ini |
37 | 40 | callback
|
38 | 41 | )
|
39 | 42 | ```
|
40 | 43 |
|
41 |
| -This gives you more complete control over the reactive properties you'd like to watch. |
| 44 | +Hal ini memberikan Anda kontrol yang lebih lengkap terhapdap properti yang reaktif yang ingin Anda amati (*watch*): |
42 | 45 |
|
43 | 46 | {% raw %}
|
44 | 47 | <div class="upgrade-path">
|
45 |
| - <h4>Upgrade Path</h4> |
| 48 | + <h4>Jalan *Upgrade*</h4> |
46 | 49 | <p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of <code>store.watch</code> with a string as the first argument.</p>
|
47 | 50 | </div>
|
48 | 51 | {% endraw %}
|
49 | 52 |
|
50 |
| -## Store's Event Emitter <sup>removed</sup> |
| 53 | +## Emiter Event Store <sup>dihapus</sup> |
51 | 54 |
|
52 |
| -The store instance no longer exposes the event emitter interface (`on`, `off`, `emit`). If you were previously using the store as a global event bus, [see this section](migration.html#dispatch-and-broadcast-removed) for migration instructions. |
53 | 55 |
|
54 |
| -Instead of using this interface to watch events emitted by the store itself (e.g. `store.on('mutation', callback)`), a new method `store.subscribe` is introduced. Typical usage inside a plugin would be: |
| 56 | +*Instance* dari store tidak lagi mengekspos interface "event emitter" (`on`, `off`, `emit`). Jika Anda menggunakan store sebagai *global event bus*, [lihat bagian ini](migration.html#dispatch-and-broadcast-removed) untuk instruksi migrasi. |
| 57 | + |
| 58 | +Ketimbang menggunakan interface ini untuk memantau even yang dikeluarkan oleh store (contoh: `store.on('mutation', callback)`), Vue menganalkan sebuah method baru `store.subscribe`. Penggunaan umum dalam sebuah plugin akan seperti: |
55 | 59 |
|
56 | 60 | ``` js
|
57 | 61 | var myPlugin = store => {
|
58 | 62 | store.subscribe(function (mutation, state) {
|
59 |
| - // Do something... |
| 63 | + // Lakukan sesuatu... |
60 | 64 | })
|
61 | 65 | }
|
62 | 66 |
|
63 | 67 | ```
|
64 | 68 |
|
65 |
| -See example [the plugins docs](https://github.com/vuejs/vuex/blob/1.0/docs/en/plugins.md) for more info. |
| 69 | +Lihat contoh [dokumentasi plugins](https://github.com/vuejs/vuex/blob/1.0/docs/en/plugins.md) untuk info lebih lanjut. |
| 70 | + |
66 | 71 |
|
67 | 72 | {% raw %}
|
68 | 73 | <div class="upgrade-path">
|
69 |
| - <h4>Upgrade Path</h4> |
70 |
| - <p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of <code>store.on</code>, <code>store.off</code>, and <code>store.emit</code>.</p> |
| 74 | + <h4>Jalur *Upgrade*</h4> |
| 75 | + <p>Jalankan <a href="https://github.com/vuejs/vue-migration-helper">pembantu migrasi</a> dalam basis kode anda untuk menemukan contoh dari <code>store.on</code>, <code>store.off</code>, dan <code>store.emit</code>.</p> |
71 | 76 | </div>
|
72 | 77 | {% endraw %}
|
73 | 78 |
|
74 |
| -## Middlewares <sup>replaced</sup> |
| 79 | +## Middlewares <sup>diganti</sup> |
75 | 80 |
|
76 |
| -Middlewares are replaced by plugins. A plugin is a function that receives the store as the only argument, and can listen to the mutation event on the store: |
| 81 | +*Middlewares* digantikan dengan plugins. Sebuah plugin adalah fungsi yang menerima store sebagai satu-satunya argumen, dan dapat mendengarkan perubahan *event* yang terjadi dalam store. |
77 | 82 |
|
78 | 83 | ``` js
|
79 | 84 | const myPlugins = store => {
|
80 | 85 | store.subscribe('mutation', (mutation, state) => {
|
81 |
| - // Do something... |
| 86 | + // Lakukan sesuatu... |
82 | 87 | })
|
83 | 88 | }
|
84 | 89 | ```
|
85 | 90 |
|
86 |
| -For more details, see [the plugins docs](https://github.com/vuejs/vuex/blob/1.0/docs/en/plugins.md). |
| 91 | +Untuk detail yang lebih jelas, lihat [dokumentasi plugins](https://github.com/vuejs/vuex/blob/1.0/docs/en/plugins.md). |
| 92 | + |
87 | 93 |
|
88 | 94 | {% raw %}
|
89 | 95 | <div class="upgrade-path">
|
90 |
| - <h4>Upgrade Path</h4> |
91 |
| - <p>Run the <a href="https://github.com/vuejs/vue-migration-helper">migration helper</a> on your codebase to find examples of the <code>middlewares</code> option on a store.</p> |
| 96 | + <h4>Jalur Upgrade</h4> |
| 97 | + <p>Jalankan <a href="https://github.com/vuejs/vue-migration-helper">pembantu migrasi</a> dalam basis kode Anda untuk menemukan contoh dari opsi <code>middlewares</code> di atas "store".</p> |
92 | 98 | </div>
|
93 | 99 | {% endraw %}
|
0 commit comments