Fix snapshots
This commit is contained in:
parent
5c48747d0f
commit
32c11d1f61
@ -92,13 +92,14 @@ export class SettingsSnapshotManager {
|
|||||||
async listSnapshots(): Promise<SettingsSnapshot[]> {
|
async listSnapshots(): Promise<SettingsSnapshot[]> {
|
||||||
const ret = await chrome.storage.local.get('uwSettings-snapshots');
|
const ret = await chrome.storage.local.get('uwSettings-snapshots');
|
||||||
try {
|
try {
|
||||||
JSON.parse(ret['uwSettings-snapshots']) as SettingsSnapshot[];
|
const json = JSON.parse(ret['uwSettings-snapshots']) as SettingsSnapshot[];
|
||||||
|
return json;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [] as SettingsSnapshot[];
|
return [] as SettingsSnapshot[];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async set(snapshots: SettingsSnapshot[]) {
|
private async set(snapshots: SettingsSnapshot[] = []) {
|
||||||
await chrome.storage.local.set({
|
await chrome.storage.local.set({
|
||||||
'uwSettings-snapshots': JSON.stringify(snapshots),
|
'uwSettings-snapshots': JSON.stringify(snapshots),
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user