JS Cookie Library
Mon Jul 11 2022 15:24:48 GMT+0000 (Coordinated Universal Time)
Saved by
@latte26
#javascript
With this library, you can create cookies using Cookies.set(). You can also define the number of days until the cookie expires:
Cookies.set('name', 'Buffy', { expires: 365 });
Additionally, you can use Cookies.set() to update cookies.
Cookies.set('name', 'Sabrina', { expires: 50 });
With the JavaScript Cookie library, you can specify which data you want to extract using Cookies.get():
Cookies.get('name'); //returns Sabrina
To delete a cookie, you no longer need to specify an expiry date in the past; instead, you can use:
Cookies.remove('name');
content_copyCOPY
https://github.com/js-cookie/js-cookie/tree/latest#readme
Comments