fix: crash due to chrome been undefined

This commit is contained in:
Jixun 2021-12-19 23:43:38 +00:00
parent 4c4c4419d1
commit aeb2dc6550
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@ declare var chrome: any;
export default class ChromeExtensionStorage extends BaseStorage {
static get works(): boolean {
return Boolean(chrome?.storage?.local?.set);
return typeof chrome !== 'undefined' && Boolean(chrome?.storage?.local?.set);
}
protected async load<T>(name: string, defaultValue: T): Promise<T> {