Cookie

April 11, 2019 ยท View on GitHub

The cookie service allows to gain easy get and set access for client side cookies data.

API

set()

Set a new cookie

ParamTypeDescription
namestringName of the cookie
valuestringValue of cookie to set
daysnumericNumber of days for cookie to be set

Return Value

Returns cookie object instance.

Example

cookie.set('myCookieName', 'myCookieValue', 7 /* days */);

get()

Get cookie value by cookie name

ParamTypeDescription
namestringName of the cookie

Return Value

Value of requested cookie or null if no cookie was found.

Example

let value = cookie.get('myCookieName'); // string value