Indexeddb IDBKeyRange.only is not a function

I am working on a Cordoba application that uses some Indexeddb (with stand for iOS).

I use IDBKeyRange to store objects with a specific index. This works well in the Chrome browser, but has some problems on Android and iOS.

I have the following TypeScript that was inspired by the MDN example :

 var transaction = this.db.transaction(objectStoreName, "readonly"); var objectStore = transaction.objectStore(objectStoreName); var index: any = objectStore.index(indexName); var request = index.getAll(IDBKeyRange.only(indexValue)); 

When working in Chrome on my desktop, everything is fine. When I run the same code in compiled Android or iOS applications, I see:

 TypeError: IDBKeyRange.only is not a function 

I left the IDBKeyRange object and apparently is the function itself, but this does not help, since it does the same thing in the browser (working as expected). Chrome logs out:

 function IDBKeyRange() 

My first attempt to solve the problem was to more closely monitor the MDN example and do something like:

  window.IDBKeyRange = window.IDBKeyRange || window.webkitIDBKeyRange || window.msIDBKeyRange; 

But the same behavior happened. Any suggestions?

Update:

I tried to do this on two different Android Galaxy Tab As. Both with the same model number and Android version (5.0.2). This works on one device, but not on another (wut). The same code, the same data, the same build process.

And with further digging, it seems that the index.getAll is not a function error occurs without turning on IDBKeyRange.only(indexValue) at all. When index IDBIndex out, I get an IDBIndex object that does not have any methods.

+5
source share

All Articles