Skip to content

Commit

Permalink
check whether browser support indexedDB before enabling recording
Browse files Browse the repository at this point in the history
  • Loading branch information
eric2788 committed Oct 21, 2024
1 parent 4f32492 commit 8aac5b1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/options/fragments/features.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ function FeatureSettings({ state, useHandler }: StateProxy<SettingSchema>): JSX.
const toggleRecord = (feature: FeatureType) => {
if (state.enabledRecording.includes(feature)) {
state.enabledRecording = state.enabledRecording.filter(f => f !== feature)
} else {
} else if (window.indexedDB) {
state.enabledRecording.push(feature)
} else {
toast.error('当前浏览器不支持 IndexedDB,无法启用离线记录。', { position: 'top-center' })
}
}

Expand Down

0 comments on commit 8aac5b1

Please sign in to comment.