Cookie JS
The cookies component make you able to save some data as a cookie.
js
import Cookie from "@natachah/vanilla-frontend/js/_cookie"Javascript
This component is only in javascript, to use it you must import the javascript file and create a new Cookie object.
You can customize the name of the cookie when initiate the component.
js
import Cookie from "@natachah/vanilla-frontend/js/utilities/_cookie"
new Cookie('name_of_the_cookie')Methods
| Method | Description |
|---|---|
| value | This GET method will return the full cookie value |
| set(value) | This method will save a value as a cookie, the value must be an Object |
| has(key) | This method will check if the cookie has a certain key |
| get(key) | This method will get a key/value saved inside the cookie |
| delete() | This method will delete the cookie |