2021-11-28 00:38:36 +01:00
|
|
|
|
|
|
|
namespace pxsim.storage {
|
|
|
|
|
2021-11-28 04:30:27 +01:00
|
|
|
export function putValue(key: string, value: string) : void {
|
2021-11-28 00:38:36 +01:00
|
|
|
sessionStorage.setItem('simulatorValue_'+key, value);
|
|
|
|
}
|
|
|
|
|
2021-11-28 04:30:27 +01:00
|
|
|
export function putValueInt(key: string, value: number) : void {
|
2021-11-28 03:54:02 +01:00
|
|
|
sessionStorage.setItem('simulatorValue_'+key, value+"");
|
|
|
|
}
|
|
|
|
|
2021-11-28 00:38:36 +01:00
|
|
|
export function getValue(key: string) : string {
|
|
|
|
if(sessionStorage.getItem('simulatorValue_'+key)) {
|
|
|
|
return sessionStorage.getItem('simulatorValue_'+key);
|
|
|
|
} else {
|
|
|
|
return "";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-28 03:54:02 +01:00
|
|
|
export function getValueInt(key: string) : number {
|
|
|
|
if(sessionStorage.getItem('simulatorValue_'+key)) {
|
|
|
|
return parseFloat(sessionStorage.getItem('simulatorValue_'+key));
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export function removeStr(key: string) : void {
|
|
|
|
sessionStorage.removeItem('simulatorValue_'+key);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function removeInt(key: string) : void {
|
2021-11-28 00:38:36 +01:00
|
|
|
sessionStorage.removeItem('simulatorValue_'+key);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|