Skip to content

Commit

Permalink
Fix wrong variables names.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ledorub authored and Violet-Bora-Lee committed Dec 5, 2020
1 parent 5d2e6cf commit 2a9f01f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions 6-data-storage/03-indexeddb/article.md
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,7 @@ openRequest.onupgradeneeded = function() {
// we must create the index here, in versionchange transaction
let books = db.createObjectStore('books', {keyPath: 'id'});
*!*
let index = inventory.createIndex('price_idx', 'price');
let index = books.createIndex('price_idx', 'price');
*/!*
};
```
Expand Down Expand Up @@ -698,7 +698,7 @@ let request = priceIdx.openCursor(IDBKeyRange.upperBound(5));
request.onsuccess = function() {
let cursor = request.result;
if (cursor) {
let key = cursor.primaryKey; // next object store key (id field)
let primaryKey = cursor.primaryKey; // next object store key (id field)
let value = cursor.value; // next object store object (book object)
let key = cursor.key; // next index key (price)
console.log(key, value);
Expand All @@ -718,7 +718,7 @@ Let's use a thin promise wrapper <https://github.com/jakearchibald/idb> further
Then, instead of `onsuccess/onerror` we can write like this:

```js
let db = await idb.openDb('store', 1, db => {
let db = await idb.openDB('store', 1, db => {
if (db.oldVersion == 0) {
// perform the initialization
db.createObjectStore('books', {keyPath: 'id'});
Expand Down

0 comments on commit 2a9f01f

Please sign in to comment.