Constructor
new CookieManager()
Create a new cookie manager.
Methods
get(key) → {string}
Get a cookie.
Parameters:
Name | Type | Description |
---|---|---|
key | string | Key of cookie |
Returns:
Value of cookie
- Type:
- string
has(key) → {boolean}
Check if a cookie exists.
Parameters:
Name | Type | Description |
---|---|---|
key | string | Key of cookie |
Returns:
Whether cookie exists
- Type:
- boolean
init()
Initialize the cookie manager and load all specified cookies.
load(cookies)
Set which cookies to load upon initialization.
Parameters:
Name | Type | Description |
---|---|---|
cookies | Object | Object containing cookie keys and their default values. |
set(name, val)
Set a cookie and its value.
Parameters:
Name | Type | Description |
---|---|---|
name | string | Key of cookie |
val | string | Value of cookie |