Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit af95ad1

Browse files
committed
Fix wrong variables names.
1 parent f489145 commit af95ad1

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎6-data-storage/03-indexeddb/article.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ openRequest.onupgradeneeded = function() {
551551
// we must create the index here, in versionchange transaction
552552
let books = db.createObjectStore('books', {keyPath: 'id'});
553553
*!*
554-
let index = inventory.createIndex('price_idx', 'price');
554+
let index = books.createIndex('price_idx', 'price');
555555
*/!*
556556
};
557557
```
@@ -698,7 +698,7 @@ let request = priceIdx.openCursor(IDBKeyRange.upperBound(5));
698698
request.onsuccess = function() {
699699
let cursor = request.result;
700700
if (cursor) {
701-
let key = cursor.primaryKey; // next object store key (id field)
701+
let primaryKey = cursor.primaryKey; // next object store key (id field)
702702
let value = cursor.value; // next object store object (book object)
703703
let key = cursor.key; // next index key (price)
704704
console.log(key, value);
@@ -718,7 +718,7 @@ Let's use a thin promise wrapper <https://github.com/jakearchibald/idb> further
718718
Then, instead of `onsuccess/onerror` we can write like this:
719719

720720
```js
721-
let db = await idb.openDb('store', 1, db => {
721+
let db = await idb.openDB('store', 1, db => {
722722
if (db.oldVersion == 0) {
723723
// perform the initialization
724724
db.createObjectStore('books', {keyPath: 'id'});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /