Skip to content

Commit

Permalink
feat: check whether support 'indexedDB'
Browse files Browse the repository at this point in the history
  • Loading branch information
wqcstrong committed Oct 31, 2023
1 parent 6c1d956 commit ca93aef
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/plugins/database.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,15 @@ export class DatabasePlugin implements PageSpyPlugin {

public static hasInitd = false;

private static get isSupport() {
if (!IDBFactory || !IDBObjectStore || !window.indexedDB) return false;
return true;
}

// eslint-disable-next-line class-methods-use-this
public onCreated() {
if (!DatabasePlugin.isSupport) return;

if (DatabasePlugin.hasInitd) return;
DatabasePlugin.hasInitd = true;

Expand Down

0 comments on commit ca93aef

Please sign in to comment.