SOLVED - Thank you to hints from Jared Smith and Pointy.
async function getKeyIndex(storeName) {
return new Promise((resolve, reject) => {
const dbStore = [];
let c = 0;
const objectStore = db.transaction(storeName).objectStore(storeName);
const cursorRequest = objectStore.openCursor();
cursorRequest.onsuccess = (event) => {
const cursor = event.target.result;
if (cursor) {
console.log("Name: " + cursor.key + " - id: " + cursor.value.id);
dbStore.push(cursor.value.id);
c++;
cursor.continue();
} else {
resolve(dbStore);
}
};
});
}
Fired by:
keyIndex = await getKeyIndex('conversations');
console.log("Database keys " + keyIndex);