mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: protect stale extension context
App would crash on storage manipulation when context is stale
This commit is contained in:
parent
f54f2ea440
commit
effaca1f2c
1 changed files with 8 additions and 4 deletions
|
|
@ -1,9 +1,13 @@
|
|||
const localStorage = browser.storage.local
|
||||
|
||||
export function get(mapping: string[] | null): Promise<any> {
|
||||
return localStorage.get(mapping || undefined)
|
||||
export function get(mapping: string[] | null): Promise<any> | any {
|
||||
try {
|
||||
return localStorage.get(mapping || undefined)
|
||||
} catch (err) {}
|
||||
}
|
||||
|
||||
export function set(value: any): Promise<void> {
|
||||
return localStorage.set(value)
|
||||
export function set(value: any): Promise<void> | void {
|
||||
try {
|
||||
return localStorage.set(value)
|
||||
} catch (err) {}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue