StorageUtils

Utilities for saving and retrieving data from local/session storage as well as a cookie backup.
Source:

Methods

(static) get(key, typeopt) → {String}

Retrieves a value from the selected storage type.
Source:
Parameters:
Name Type Attributes Default Description
key String The key to retrieve the value of. Values will be parsed using `JSON.parse()`.
type String <optional>
'local' The type of storage to retrieve from. Available types include 'local', 'session', and 'cookie'.
Returns:
- The value at the specified key.
Type
String
StorageUtils.get(foo');

(static) remove(key, typeopt) → {void}

Removes a stored value from the specified storage type.
Source:
Parameters:
Name Type Attributes Default Description
key String The key of the value to remove.
type String <optional>
'local' The type of storage to remove from. Available types include 'local', 'session', and 'cookie'.
Returns:
Type
void
StorageUtils.remove(foo');

(static) set(key, value, typeopt, cookieExpiresopt) → {void}

Sets a value in the selected storage type.
Source:
Parameters:
Name Type Attributes Default Description
key String The key to save the value as.
value * The value to set. Values will be run through `JSON.stringify()`.
type String <optional>
'local' The type of storage to use. Available types include 'local', 'session', and 'cookie'.
cookieExpires Number <optional>
1 Days when a cookie will expire if the type is set to 'cookie'.
Returns:
Type
void
StorageUtils.set('foo', 'bar');