cookie/js/Cookie.js:47
Cookie utility.
_createCookieHashString
hash
Defined in
cookie/js/Cookie.js:104
Formats a cookie value for an object containing multiple values.
hash
Object
An object of key-value pairs to create a string for.
A string suitable for use as a cookie value.
_createCookieString
name
value
encodeValue
options
Defined in
cookie/js/Cookie.js:58
Creates a cookie string that can be assigned into document.cookie.
The formatted cookie string.
_parseCookieHash
text
Defined in
cookie/js/Cookie.js:128
Parses a cookie hash string into an object.
text
String
The cookie hash string to parse (format: n1=v1&n2=v2).
An object containing entries for each cookie value.
_parseCookieString
text
shouldDecode
options
Defined in
cookie/js/Cookie.js:152
Parses a cookie string into an object representing all accessible cookies.
An object containing entries for each accessible cookie.
_setDoc
newDoc
Defined in
cookie/js/Cookie.js:204
Sets the document object that the cookie utility uses for setting
cookies. This method is necessary to ensure that the cookie utility
unit tests can pass even when run on a domain instead of locally.
This method should not be used otherwise; you should use
Y.config.doc
to change the document that the cookie
utility uses for everyday purposes.
newDoc
Object
The object to use as the document.
exists
name
Defined in
cookie/js/Cookie.js:223
Determines if the cookie with the given name exists. This is useful for Boolean cookies (those that do not follow the name=value convention).
name
String
The name of the cookie to check.
True if the cookie exists, false if not.
get
name
options
Defined in
cookie/js/Cookie.js:240
Returns the cookie value for the given name.
name
String
The name of the cookie to retrieve.
options
Function | Object
(Optional) An object containing one or more cookie options: raw (true/false), reverseCookieLoading (true/false) and converter (a function). The converter function is run on the value before returning it. The function is not used if the cookie doesn't exist. The function can be passed instead of the options object for backwards compatibility. When raw is set to true, the cookie value is not URI decoded.
If no converter is specified, returns a string or null if the cookie doesn't exist. If the converter is specified, returns the value returned from the converter or null if the cookie doesn't exist.
getSub
name
subName
converter
options
Defined in
cookie/js/Cookie.js:289
Returns the value of a subcookie.
name
String
The name of the cookie to retrieve.
subName
String
The name of the subcookie to retrieve.
converter
Function
(Optional) A function to run on the value before returning it. The function is not used if the cookie doesn't exist.
options
Object
(Optional) Containing one or more settings for cookie parsing.
If the cookie doesn't exist, null is returned. If the subcookie doesn't exist, null if also returned. If no converter is specified and the subcookie exists, a string is returned. If a converter is specified and the subcookie exists, the value returned from the converter is returned.
getSubs
name
options
Defined in
cookie/js/Cookie.js:326
Returns an object containing name-value pairs stored in the cookie with the given name.
An object of name-value pairs if the cookie with the given name exists, null if it does not.
remove
name
options
Defined in
cookie/js/Cookie.js:346
Removes a cookie from the machine by setting its expiration date to sometime in the past.
The created cookie string.
removeSub
name
subName
options
Defined in
cookie/js/Cookie.js:371
Removes a sub cookie with a given name.
name
String
The name of the cookie in which the subcookie exists.
subName
String
The name of the subcookie to remove.
options
Object
(Optional) An object containing one or more cookie options: path (a string), domain (a string), expires (a Date object), removeIfEmpty (true/false), and secure (true/false). This must be the same settings as the original subcookie.
The created cookie string.
set
name
value
options
Defined in
cookie/js/Cookie.js:418
Sets a cookie with a given name and value.
name
String
The name of the cookie to set.
value
Any
The value to set for the cookie.
options
Object
(Optional) An object containing one or more cookie options: path (a string), domain (a string), expires (a Date object), secure (true/false), and raw (true/false). Setting raw to true indicates that the cookie should not be URI encoded before being set.
The created cookie string.
setSub
name
subName
value
options
Defined in
cookie/js/Cookie.js:445
Sets a sub cookie with a given name to a particular value.
The created cookie string.
setSubs
name
value
options
Defined in
cookie/js/Cookie.js:479
Sets a cookie with a given name to contain a hash of name-value pairs.
The created cookie string.