Some refactoring, more work on the custom theme generator

This commit is contained in:
Pieter Vander Vennet 2020-08-17 17:23:15 +02:00
parent c4b5f180a6
commit 146552e62c
104 changed files with 382 additions and 1590 deletions

View file

@ -0,0 +1,21 @@
import {UIEventSource} from "../UIEventSource";
export class LocalStorageSource {
static Get(key: string, defaultValue: string = undefined): UIEventSource<string> {
try {
const saved = localStorage.getItem(key);
const source = new UIEventSource<string>(saved ?? defaultValue);
source.addCallback((data) => {
localStorage.setItem(key, data);
});
return source;
} catch (e) {
return new UIEventSource<string>(defaultValue);
}
}
}