Как мне дождаться, пока все идентификаторы будут собраны, прежде чем возвращать массив?
Пока у меня это получается.
Код: Выделить всё
async function getKeyIndex(s) {
var i = await countDBRecords(s); // my own f() - no problem here.
var dbStore = [];
var c = 0;
var objectStore = db.transaction(s).objectStore(s);
objectStore.openCursor().onsuccess = event => {
var cursor = event.target.result;
if (cursor) {
console.log("Name: " + cursor.key + " - id: " cursor.value.id);
dbStore[c]= cursor.value.id;
c++;
if(c
Подробнее здесь: [url]https://stackoverflow.com/questions/79793041/creating-an-array-of-all-indexeddb-key-values-function-returns-before-completi[/url]
Мобильная версия