CookieManager

Manager of cookies for local storage in browser.

Constructor

new CookieManager()

Create a new cookie manager.

Methods

get(key) → {string}

Get a cookie.
Parameters:
NameTypeDescription
keystringKey of cookie
Returns:
Value of cookie
Type: 
string

has(key) → {boolean}

Check if a cookie exists.
Parameters:
NameTypeDescription
keystringKey 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:
NameTypeDescription
cookiesObjectObject containing cookie keys and their default values.

set(name, val)

Set a cookie and its value.
Parameters:
NameTypeDescription
namestringKey of cookie
valstringValue of cookie