Overview :
An Javascript Client-side API that handles adding, getting & removing cookies to/from document.cookie
.
It handles also complex data structure. Indeed, You can persist not only String
but also Objects
in document.cookie
.
Install
npm install chocolata --save;
Example :
NPM environment :
; ;// document.cookie ==> "token=1234" // document.cookie ==> "token=1234; otherToken=5678" //--- Handle Objects --- ; // "token=1234; otherToken=5678; userInfo={"firstName":"Ahmed","lastName":"Toumi"}" const firstName lastName = ;console
Non-NPM environment:
In this case you need to import the script as CDN.
Also, examples above are still valid. However , instead of import ..
, window.Chocolata
is the namespace of this library:
License:
MIT .