40 lines
408 B
TypeScript
40 lines
408 B
TypeScript
|
|
namespace lib_storage
|
|
{
|
|
|
|
/**
|
|
*/
|
|
export function write
|
|
(
|
|
key : string,
|
|
value : any
|
|
) : void
|
|
{
|
|
window.localStorage.setItem(key, JSON.stringify(value));
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
export function read
|
|
(
|
|
key : string
|
|
) : any
|
|
{
|
|
return JSON.parse(window.localStorage.getItem(key));
|
|
}
|
|
|
|
|
|
/**
|
|
*/
|
|
export function kill
|
|
(
|
|
key : string
|
|
) : any
|
|
{
|
|
return window.localStorage.removeItem(key);
|
|
}
|
|
|
|
}
|
|
|