Class: module:UWA/Utils/Cookie

module:UWA/Utils/Cookie

new module:UWA/Utils/Cookie()

Index

Members

Methods

Members

<static> defaults

Cookie.defaults An object representing default options to be used when setting and expiring cookie values.

Available Options
Options Description Default
path A string value of the path of the cookie "/"
domain A string value of the domain of the cookie undefined
expires A number (of seconds), a date parsable string, undefined
or a Date object of when the cookie will expire.
secure A boolean value of whether or not the cookie false
should only be available over SSL
Example
Cookie.defaults = {
    path: '/',
    secure: true
};

Methods

<static> get(key) → {String}

Returns the value of the most locally scoped cookie with the specified key.

Parameters
Name Type Description
key String

cookie key

Returns

value - cookie value

Type
String

<static> getAll() → {Object}

Returns all cookies.

Returns

result

Type
Object

<static> set(key, value, options) → {Object}

Sets a cookie in the document. If the cookie does not already exist, it will be created.

Parameters
Name Type Description
key String

cookie key

value String

cookie value

options Object

cookie options

Returns

Cookie

Type
Object

<static> expire(key, options) → {Object}

Expires a cookie, removing it from the document

Parameters
Name Type Description
key String

cookie key

options Object

cookie options

Returns
  • Cookie
Type
Object