From 1f93d633c9ba5512ab8a93435db3e0099fd8cc22 Mon Sep 17 00:00:00 2001 From: Patrick Brosset Date: Tue, 19 Nov 2024 16:50:56 +0100 Subject: [PATCH] Handle missing getAllRecords --- idb-getallrecords/index.html | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/idb-getallrecords/index.html b/idb-getallrecords/index.html index 8b19e954..f00d5ef6 100644 --- a/idb-getallrecords/index.html +++ b/idb-getallrecords/index.html @@ -175,7 +175,15 @@

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`; @@ -184,7 +192,15 @@

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`;