Global

Methods

getLocalStorage(key) → {string}

Safely get a value for a specific local storage key
Source:
Parameters:
Name Type Description
key string localStorage key to get
Returns:
Type:
string
- returns the value of the localStorage key
Example
getLocalStorage('foo'); // returns 'bar'

getSearchParam(key) → {string}

Safely get a search (query) parameter
Source:
Parameters:
Name Type Description
key string key of location.search value to get
Returns:
Type:
string
- returns the value of the requested query param
Example
getSearchParam('name'); // returns 'foo' where ?name=foo

setLocalStorage(key, value) → {Boolean}

Safely set a local storage key to a specific value
Source:
Parameters:
Name Type Description
key string localStorage key to set
value string new localStorage value
Returns:
Type:
Boolean
- returns true/false if operation succeeded without error.
Example
setLocalStorage('foo', 'bar'); // sets localStorage key `foo` to 'bar'