DisplayJoy

DisplayJoy

new DisplayJoy()

DisplayJoy Client Library
Source:
Example
var dj = new DisplayJoy();

Methods

(static) coerceBoolean(ins) → {boolean}

coerces a boolean value from an unknown variable type
Source:
Parameters:
Name Type Description
ins incoming variable
Returns:
Type:
boolean
- returns the boolean value of the incoming value
Examples
coerceBoolean('true') // returns true
coerceBoolean('tru dat') // returns true
coerceBoolean(1) // returns true
coerceBoolean(true) // returns true
coerceBoolean(0) // returns false
coerceBoolean(NaN) // returns false

(static) 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'

(static) 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

(static) 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'