オブジェクト ストアの反復ごとにコールバックを単純に実行するのではなく、objectStore 名をパラメーターとして受け取り、それを含むすべてのキー/値のペアを返す 'selectAll' メソッドを作成しようとするだけです。
つまり、indexedDB トランザクションの実行時に同期動作を模倣します。
var results = []
request.onsuccess = function(e) {
var result = e.target.result;
if (!result) {
//I could call successcallback here with JUST this 'row' of data
successCallback(result);
return;
}
//I could push the results into an array here, but I would need to 'wait' until all the onSuccess methods have fired before returning it.
results.push(result.value);
result.continue();
}
私はAngularを使用しています。約束が答えになると思います。特に、この場合に $q.all() は役立つでしょうか?