@@ -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));
698698request .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
718718Then, 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