Installation
npm install @rentspree/cookie
Update a newer version
run
npm version patch
Table of Contents
- setOption
- addChangeListener
- removeChangeListener
- setLocalItem
- getLocalItem
- getAllLocalItem
- removeLocalItem
- removeAllLocalItem
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
-
callback
function
removeChangeListener
Remove a listener from the change callback.
Parameters
-
callback
function
setLocalItem
Set a cookie value.
Parameters
getLocalItem
Get a cookie value.
Parameters
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
removeAllLocalItem
Remove all cookies that has the same prefix as the parameter.
Parameters
-
prefix
string Prefix of the cookie to be removed