fix storage functions (#174)

Co-authored-by: JW <gitkraken@juriwolf.de>
Co-authored-by: Juri <info@juriwolf.de>
This commit is contained in:
Juri Wolf 2022-04-04 18:52:34 +02:00 committed by GitHub
parent 63571fb12f
commit e2b28e7847
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,22 +1,10 @@
namespace pxsim.storage { namespace pxsim.storage {
export function putValue(key: string, value: string) : void {
sessionStorage.setItem('simulatorValue_'+key, value);
}
export function putValueInt(key: string, value: number) : void { export function putValueInt(key: string, value: number) : void {
sessionStorage.setItem('simulatorValue_'+key, value+""); sessionStorage.setItem('simulatorValue_'+key, value+"");
} }
export function getValue(key: string) : string {
if(sessionStorage.getItem('simulatorValue_'+key)) {
return sessionStorage.getItem('simulatorValue_'+key);
} else {
return "";
}
}
export function getValueInt(key: string) : number { export function getValueInt(key: string) : number {
if(sessionStorage.getItem('simulatorValue_'+key)) { if(sessionStorage.getItem('simulatorValue_'+key)) {
return parseFloat(sessionStorage.getItem('simulatorValue_'+key)); return parseFloat(sessionStorage.getItem('simulatorValue_'+key));
@ -25,11 +13,7 @@ namespace pxsim.storage {
} }
} }
export function removeStr(key: string) : void { export function remove(key: string) : void {
sessionStorage.removeItem('simulatorValue_'+key);
}
export function removeInt(key: string) : void {
sessionStorage.removeItem('simulatorValue_'+key); sessionStorage.removeItem('simulatorValue_'+key);
} }