Installation
npm install @rentspree/cookie
Update a newer version
run
npm version patch
Table of Contents
setOption
Set options for the to be stored cookies.
Parameters
options
Object (optional, default {}
)
addChangeListener
Add a listener to when a cookie is set or removed.
Parameters
removeChangeListener
Remove a listener from the change callback.
Parameters
setLocalItem
Set a cookie value.
Parameters
getLocalItem
Get a cookie value.
Parameters
name
string Cookie's nameoptions
Object Cookie's options (optional, default {}
)
Returns any cookie or false if cookie is not found.
getAllLocalItem
Get all cookies.
Parameters
options
Object (optional, default {}
)
Returns all cookies.
removeLocalItem
Remove a cookie.
Parameters
name
string Cookie's nameoptions
Object Cookie's options (optional, default {}
)
removeAllLocalItem
Remove all cookies that has the same prefix as the parameter.
Parameters
prefix
string Prefix of the cookie to be removed
License
MIT (http://www.opensource.org/licenses/mit-license.php)