Skip to content

Commit

Permalink
Handle missing getAllRecords
Browse files Browse the repository at this point in the history
  • Loading branch information
captainbrosset committed Nov 19, 2024
1 parent 5a36006 commit 1f93d63
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions idb-getallrecords/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,15 @@ <h3></h3>
newReadButton.addEventListener("click", async () => {
setAsLoading();
startMeasuring();
await readInBatches(db, batchSize);

try {
await readInBatches(db, batchSize);
} catch (e) {
if (useGetAllRecords) {
durationLabel.textContent = "Your browser doesn't support getAllRecords() yet.";
}
}

const duration = stopMeasuring();
setAsReady();
durationLabel.textContent = `Read in ${duration}ms`;
Expand All @@ -184,7 +192,15 @@ <h3></h3>
newReadReverseButton.addEventListener("click", async () => {
setAsLoading();
startMeasuring();
await readInBatchesReverse(db, batchSize);

try {
await readInBatchesReverse(db, batchSize);
} catch (e) {
if (useGetAllRecords) {
durationLabel.textContent = "Your browser doesn't support getAllRecords() yet.";
}
}

const duration = stopMeasuring();
setAsReady();
durationLabel.textContent = `Read in ${duration}ms`;
Expand Down

0 comments on commit 1f93d63

Please sign in to comment.