Add GetParsed to localStorageSource
This commit is contained in:
parent
3ecfef9bc1
commit
a78e3866e0
2 changed files with 3 additions and 3 deletions
|
@ -25,13 +25,13 @@ export class Changes implements FeatureSource {
|
||||||
/**
|
/**
|
||||||
* All the pending changes
|
* All the pending changes
|
||||||
*/
|
*/
|
||||||
public readonly pending: UIEventSource<{ elementId: string, key: string, value: string }[]> = LocalStorageSource.GetParsed("pending-changes", [])
|
public readonly pending = LocalStorageSource.GetParsed<{ elementId: string, key: string, value: string }[]>("pending-changes", [])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* All the pending new objects to upload
|
* All the pending new objects to upload
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
private readonly newObjects: UIEventSource<{ id: number, lat: number, lon: number }[]> = LocalStorageSource.GetParsed("newObjects", [])
|
private readonly newObjects = LocalStorageSource.GetParsed<{ id: number, lat: number, lon: number }[]>("newObjects", [])
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a change to the pending changes
|
* Adds a change to the pending changes
|
||||||
|
|
|
@ -5,7 +5,7 @@ import {UIEventSource} from "../UIEventSource";
|
||||||
*/
|
*/
|
||||||
export class LocalStorageSource {
|
export class LocalStorageSource {
|
||||||
|
|
||||||
static GetParsed(key: string, defaultValue : any){
|
static GetParsed<T>(key: string, defaultValue : T) : UIEventSource<T>{
|
||||||
return LocalStorageSource.Get(key).map(
|
return LocalStorageSource.Get(key).map(
|
||||||
str => {
|
str => {
|
||||||
if(str === undefined){
|
if(str === undefined){
|
||||||
|
|
Loading…
Reference in a new issue