Indexed DB has a specification saying that you can access the indexed database synchronously, but it is not yet implemented.
I'm just wondering if there is a way to do this synchronously manually
My JavaScript looks like this:
var trans = databaseAsync.transaction(["mapTile"], IDBTransaction.READ_WRITE); var store = trans.objectStore("mapTile"); var keyRange = IDBKeyRange.bound(evt.data[0], evt.data[0]); var cursorRequest = store.openCursor(keyRange);
So, can you add something there to make it wait until the onsuccess method is called?
The reason I want to do this is because the code above in this method is
dojo.extend(esri.layers.ArcGISTiledMapServiceLayer, { getTileUrl : function(level, row, col) { // blah return url; }
So, this is an ESRI tile layer (which uploads tiles to a map on my web page), and this method should immediately return the URL for a specific tile. This will either be the URL to download the image if it is not already cached in the database, or this,
data:image;base64,*BASE64DATA*
Where BASE64DATA is the data from the database, if it was previously cached.
I previously used localStorage for this, which works synchronously, but has a 5 MB limit, so I thought I would experiment with indexedDB.