You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We only have to be on the same origin (domain/port/protocol), the url path can be different.
46
-
47
45
Kita hanya harus berada di *origin* yang sama (domain/port/protocol), *path* urlnya bisa berbeda.
48
46
49
47
`localStorage` dibagi antara semua *window* dengan *origin* yang sama, jadi jika kita mengatur data di satu *window*, perubahan akan terlihat di *window* lain.
50
48
51
49
## Akses seperti objek
52
50
53
-
We can also use a plain object way of getting/setting keys, like this:
54
-
55
51
Kita juga dapat menggunakan cara sebuah objek biasa untuk mendapatkan/mengatur *key*, seperti ini:
56
52
57
53
```js run
@@ -137,15 +133,15 @@ Kita dapat menggunakan `JSON` untuk menyimpan objek:
Harap perhatikan bahwa *event* juga berisi:`event.url`-- url dokumen tempat data diperbarui.
215
211
216
-
Also, `event.storageArea`contains the storage object --the event is the same for both `sessionStorage`and`localStorage`, so`event.storageArea`references the one that was modified. We may even want to set something back in it, to "respond" to a change.
212
+
Selain itu, `event.storageArea`berisi objek penyimpanan --*event*-nya sama untuk `sessionStorage`dan`localStorage`, jadi`event.storageArea`merujuk ke yang telah dimodifikasi. Kita bahkan mungkin ingin mengatur sesuatu kembali di dalamnya, untuk "merespons" perubahan.
217
213
218
214
**Itu memungkinkan window yang berbeda dari origin yang sama untuk bertukar pesan.**
0 commit comments