H
H
heIIfire2019-05-28 15:29:43
JavaScript
heIIfire, 2019-05-28 15:29:43

Why is IDBKeyRange not working in Firefox?

Here is the code to get data from IndexedDB. The thing is that in Chrome everything works with a bang, but in Firefox I get an empty array

const transaction = DB.transaction(['history_object_store'], 'readonly');
    const store = transaction.objectStore('history_object_store');
    const index = store.index('id');
    const openCursor = index.openCursor(IDBKeyRange.upperBound(50));
    new Promise((resolve, reject) => {
       const entries = [];
       openCursor.onsuccess = function(e){
       const cursor = e.target.result;
       if(cursor) {
           entries.push(cursor.value)
        } else {
           resolve(entries);
        }
      }
   });

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question