|
5 | 5 |
|
6 | 6 | # IndexedDB |
7 | 7 |
|
8 | | -IndexedDB is a database, that is built into browser, much more powerful than `localStorage`. |
| 8 | +IndexedDB is a database that is built into browser, much more powerful than `localStorage`. |
9 | 9 |
|
10 | 10 | - Stores almost any kind of values by keys, multiple key types. |
11 | 11 | - Supports transactions for reliability. |
@@ -75,10 +75,10 @@ We can open it with version `2` and perform the upgrade like this: |
75 | 75 | ```js |
76 | 76 | let openRequest = indexedDB.open("store", *!*2*/!*); |
77 | 77 |
|
78 | | -openRequest.onupgradeneeded = function() { |
| 78 | +openRequest.onupgradeneeded = function(event) { |
79 | 79 | // the existing database version is less than 2 (or it doesn't exist) |
80 | 80 | let db = openRequest.result; |
81 | | - switch(db.version) { // existing db version |
| 81 | + switch(event.oldVersion) { // existing db version |
82 | 82 | case 0: |
83 | 83 | // version 0 means that the client had no database |
84 | 84 | // perform initialization |
|
0 commit comments