fix: wrap localStorage sets in try/catch
This commit is contained in:
parent
9f7725cec1
commit
e0b70d53cd
@ -70,7 +70,11 @@ class Storage {
|
|||||||
extend(storage, object);
|
extend(storage, object);
|
||||||
|
|
||||||
// Update storage
|
// Update storage
|
||||||
window.localStorage.setItem(this.key, JSON.stringify(storage));
|
try {
|
||||||
|
window.localStorage.setItem(this.key, JSON.stringify(storage));
|
||||||
|
} catch (_) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,12 +60,16 @@ export default function loadSprite(url, id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (useStorage) {
|
if (useStorage) {
|
||||||
window.localStorage.setItem(
|
try {
|
||||||
`${prefix}-${id}`,
|
window.localStorage.setItem(
|
||||||
JSON.stringify({
|
`${prefix}-${id}`,
|
||||||
content: result,
|
JSON.stringify({
|
||||||
}),
|
content: result,
|
||||||
);
|
}),
|
||||||
|
);
|
||||||
|
} catch (_) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
update(container, result);
|
update(container, result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user