demo · v133
getAllRecords
Seed an object store with 50 items, then call getAllRecords({ count, direction }) and compare with the older getAll / getAllKeys dance. Direction "prev" reads from the end without opening a cursor.
click "seed db", then run a query
checking support…
the code
// Chrome 133+:
const records = await new Promise((res, rej) => {
const r = store.getAllRecords({ count: 5, direction: "prev" });
r.onsuccess = () => res(r.result); // [{ key, primaryKey, value }, ...]
r.onerror = () => rej(r.error);
});