Skip to content

Commit 6a4c419

Browse files
committed
minor
1 parent 2009009 commit 6a4c419

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

6-data-storage/02-localstorage/article.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ localStorage.setItem('test', 1);
4242
alert( localStorage.getItem('test') ); // 1
4343
```
4444

45-
We only have to be on the same domain/port/protocol, the url path can be different.
45+
We only have to be on the same origin (domain/port/protocol), the url path can be different.
4646

47-
The `localStorage` is shared, so if we set the data in one window, the change becomes visible in the other one.
47+
The `localStorage` is shared between all windows with the same origin, so if we set the data in one window, the change becomes visible in another one.
4848

4949
## Object-like access
5050

@@ -73,7 +73,7 @@ That's allowed for historical reasons, and mostly works, but generally not recom
7373

7474
## Looping over keys
7575

76-
As we've seen, the methods provide get/set/remove functionality. But how to get all saved values or keys?
76+
As we've seen, the methods provide "get/set/remove by key" functionality. But how to get all saved values or keys?
7777
7878
Unfortunately, storage objects are not iterable.
7979
@@ -198,7 +198,7 @@ Imagine, you have two windows with the same site in each. So `localStorage` is s
198198
You might want to open this page in two browser windows to test the code below.
199199
```
200200

201-
Now if both windows are listening for `window.onstorage`, then each one will react on updates that happened in the other one.
201+
If both windows are listening for `window.onstorage`, then each one will react on updates that happened in the other one.
202202

203203
```js run
204204
// triggers on updates made to the same storage from other documents
@@ -229,18 +229,18 @@ Web storage objects `localStorage` and `sessionStorage` allow to store key/value
229229
| `localStorage` | `sessionStorage` |
230230
|----------------|------------------|
231231
| Shared between all tabs and windows with the same origin | Visible within a browser tab, including iframes from the same origin |
232-
| Survives browser restart | Dies on tab close |
232+
| Survives browser restart | Survives page refresh (but not tab close) |
233233

234234
API:
235235

236236
- `setItem(key, value)` -- store key/value pair.
237237
- `getItem(key)` -- get the value by key.
238238
- `removeItem(key)` -- remove the key with its value.
239239
- `clear()` -- delete everything.
240-
- `key(index)` -- get the key on a given position.
240+
- `key(index)` -- get the key number `index`.
241241
- `length` -- the number of stored items.
242242
- Use `Object.keys` to get all keys.
243-
- Can use the keys as object properties, in that case `storage` event isn't triggered.
243+
- We access keys as object properties, in that case `storage` event isn't triggered.
244244
245245
Storage event:
246246

0 commit comments

Comments
 (0)