File tree 1 file changed +16
-17
lines changed
1 file changed +16
-17
lines changed Original file line number Diff line number Diff line change @@ -175,35 +175,34 @@ <h3></h3>
175
175
newReadButton . addEventListener ( "click" , async ( ) => {
176
176
setAsLoading ( ) ;
177
177
startMeasuring ( ) ;
178
-
178
+ let error = null ;
179
+
179
180
try {
180
181
await readInBatches ( db , batchSize ) ;
181
182
} catch ( e ) {
182
- if ( useGetAllRecords ) {
183
- durationLabel . textContent = "Your browser doesn't support getAllRecords() yet." ;
184
- }
183
+ error = e ;
184
+ } finally {
185
+ const duration = stopMeasuring ( ) ;
186
+ setAsReady ( ) ;
187
+ durationLabel . textContent = error ? "Your browser doesn't support getAllRecords()" : `Read in ${ duration } ms` ;
185
188
}
186
-
187
- const duration = stopMeasuring ( ) ;
188
- setAsReady ( ) ;
189
- durationLabel . textContent = `Read in ${ duration } ms` ;
189
+
190
190
} ) ;
191
-
191
+
192
192
newReadReverseButton . addEventListener ( "click" , async ( ) => {
193
193
setAsLoading ( ) ;
194
194
startMeasuring ( ) ;
195
-
195
+ let error = null ;
196
+
196
197
try {
197
198
await readInBatchesReverse ( db , batchSize ) ;
198
199
} catch ( e ) {
199
- if ( useGetAllRecords ) {
200
- durationLabel . textContent = "Your browser doesn't support getAllRecords() yet." ;
201
- }
200
+ error = e ;
201
+ } finally {
202
+ const duration = stopMeasuring ( ) ;
203
+ setAsReady ( ) ;
204
+ durationLabel . textContent = error ? "Your browser doesn't support getAllRecords()" : `Read in ${ duration } ms` ;
202
205
}
203
-
204
- const duration = stopMeasuring ( ) ;
205
- setAsReady ( ) ;
206
- durationLabel . textContent = `Read in ${ duration } ms` ;
207
206
} ) ;
208
207
209
208
setAsReady ( ) ;
You can’t perform that action at this time.
0 commit comments