glize/dom/cookies

Requires

Methods

(static) clear()

Removes and expires all cookie.
Source:

(static) get(key, opt_defaultopt) → {string}

Gets the value for the first cookie with the given name.
Source:
Parameters:
Name Type Attributes Description
key string The name of the cookie to get.
opt_default string <optional>
The optional default value.
Returns:
Type:
string
The value of the cookie. If no cookie is set this returns opt_default or undefined if opt_default is not provided.

(static) keys() → (non-null) {Array.<string>}

Gets list of stored keys.
Source:
Returns:
Type:
Array.<string>
Returns list of stored keys.

(static) remove(key) → {boolean}

Removes and expires a cookie.
Source:
Parameters:
Name Type Description
key string The cookie name.
Returns:
Type:
boolean
Whether the cookie existed before it was removed.

(static) set(key, value, expiration, opt_domainopt)

Sets a cookie.
Source:
Parameters:
Name Type Attributes Description
key string The name of the cookie.
value string The value of the cookie.
expiration number The days after the cookie expires.
opt_domain string <optional>
Optional, domain that the cookie belongs to.