Class: CookieManager

Cadcorp.Util.CookieManager

new CookieManager()

Manages getting and setting cookies

Methods

createCookie(name, value, days)

Creates a cookie
Parameters:
Name Type Description
name string The identifier of the cookie to be set
value string The value to be stored, this can be a string representation of an object
days mumber The number of days to store this cookie

eraseCookie(name)

Remove a previously set cookie
Parameters:
Name Type Description
name string The identifier of the cookie to be erase

haveConsent() → {boolean}

Indicates whether the user has agreed to cookies being stored.
Returns:
Returns true if the user has accpeted cookies, otherwise false
Type
boolean

readCookie(name) → {string}

Reads a cookie
Parameters:
Name Type Description
name string The identifier of the cookie to be set
Returns:
The value of the previously stored cookie or null
Type
string

removeConsent()

Removes user consent to store cookies

setConsent()

Called when the user has agreed to cookies being stored