indexedDBから取得した結果を並べ替えたい。
各レコードの構造は{id、text、date}です。ここで、「id」はkeyPathです。
結果を日付で並べ替えたい。
私の現在のコードは次のとおりです。
var trans = db.transaction(['msgs'], IDBTransaction.READ);
var store = trans.objectStore('msgs');
// Get everything in the store;
var keyRange = IDBKeyRange.lowerBound("");
var cursorRequest = store.openCursor(keyRange);
cursorRequest.onsuccess = function(e) {
var result = e.target.result;
if(!!result == false){
return;
}
console.log(result.value);
result.continue();
};