-Nuke the localstorage if it is full
This commit is contained in:
parent
1eca0a0f42
commit
75f33ee580
3 changed files with 16 additions and 5 deletions
|
@ -213,6 +213,7 @@ export class InitUiElements {
|
||||||
userLayoutParam.setData(layoutToUse.id);
|
userLayoutParam.setData(layoutToUse.id);
|
||||||
return layoutToUse;
|
return layoutToUse;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
new FixedUiElement("Error: could not parse the custom layout:<br/> " + e).AttachTo("centermessage");
|
new FixedUiElement("Error: could not parse the custom layout:<br/> " + e).AttachTo("centermessage");
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,8 @@
|
||||||
import {UIEventSource} from "../UIEventSource";
|
import {UIEventSource} from "../UIEventSource";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UIEventsource-wrapper around localStorage
|
||||||
|
*/
|
||||||
export class LocalStorageSource {
|
export class LocalStorageSource {
|
||||||
|
|
||||||
static Get(key: string, defaultValue: string = undefined): UIEventSource<string> {
|
static Get(key: string, defaultValue: string = undefined): UIEventSource<string> {
|
||||||
|
@ -8,7 +11,14 @@ export class LocalStorageSource {
|
||||||
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:"+key);
|
const source = new UIEventSource<string>(saved ?? defaultValue, "localstorage:"+key);
|
||||||
|
|
||||||
source.addCallback((data) => {
|
source.addCallback((data) => {
|
||||||
|
try{
|
||||||
localStorage.setItem(key, data);
|
localStorage.setItem(key, data);
|
||||||
|
}catch(e){
|
||||||
|
// Probably exceeded the quota with this item!
|
||||||
|
// Lets nuke everything
|
||||||
|
localStorage.clear()
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
return source;
|
return source;
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Utils } from "../Utils";
|
||||||
|
|
||||||
export default class Constants {
|
export default class Constants {
|
||||||
|
|
||||||
public static vNumber = "0.6.3";
|
public static vNumber = "0.6.3a";
|
||||||
|
|
||||||
// The user journey states thresholds when a new feature gets unlocked
|
// The user journey states thresholds when a new feature gets unlocked
|
||||||
public static userJourney = {
|
public static userJourney = {
|
||||||
|
|
Loading…
Reference in a new issue