new LocalStorage()
Static helper class for local storage
Methods
-
<static> clear()
-
Clear all saved items in local storage
Returns:
returns self for chaining -
<static> getItem(id)
-
Get saved value
Parameters:
Name Type Description idstring Returns:
- Type
- object | null
-
<static> hasItem(id)
-
Check if there exists saved item
Parameters:
Name Type Description idstring Returns:
- Type
- boolean
-
<static> isSupported()
-
Check if local storage is supported https://developer.mozilla.org/en-US/docs/Web/API/Web_Storage_API/Using_the_Web_Storage_API
Returns:
- Type
- boolean
-
<static> keys()
-
Get all keys in localStorage
Returns:
array of keys -
<static> removeItem(id)
-
Remove stored item
Parameters:
Name Type Description idstring Returns:
returns self for chaining -
<static> setItem(id, value)
-
Set saved value
Parameters:
Name Type Description idstring valueobject Returns:
returns self for chaining