Wrapper for localstorage / sessionstorage data serialization.
Each method has a boolean parameter, that when set as true switches the method
to use sessionStorage rather than the default localStorage.
- Source:
Methods
-
<static> clear(session)
-
Removes all values from the same domain storage
Parameters:
Name Type Description session
bool - Source:
-
<static> get(key, session) → {Object}
-
Retrieves and deserializes a value from localstorage, based on the specified key
Parameters:
Name Type Description key
string session
bool - Source:
Returns:
- Type
- Object
-
<static> getAll(session) → {Object}
-
Returns an object of all the raw values in storage
Parameters:
Name Type Description session
bool - Source:
Returns:
- Type
- Object
-
<static> remove(key, session)
-
Removes the specified item from storage
Parameters:
Name Type Description key
string session
bool - Source:
-
<static> set(key, value, session)
-
Puts a value into localstorage at the specified key, and JSON-encodes the value if not a string
Parameters:
Name Type Description key
string value
mixed session
bool - Source: