Skip to content

alt-javascript/cookies

Repository files navigation

Simple utility to ease the use of browser cookies.

NPM
Language Badge Package Badge
release notes

Simple utility to ease the use of browser cookies.

The module is also able to be used directly in the browser, as an IIFE (Immediately Invoked Function Expression), as follows:

   <script src="https://cdn.jsdelivr.net/npm/@alt-javascript/cookies/dist/alt-javascript-cookies-iife.js"></script>

   <script>
       cookies.setCookie('somecookie','giveitavalue',365,'Strict');// expires in 365 days, SameSite == Strict (default)
       cookies.getCookie('somecookie');
       cookies.deleteCookie('somecookie');
   </script>

Or import the ES6 module bundle from a module, as follows:

import { Cookies } from 'https://cdn.jsdelivr.net/npm/@alt-javascript/cookies/dist/alt-javascript-cookies-esm.js'

let cookies = new Cookies();

//...as above

Logger

The Cookies class optionally accepts an @alt-javascript/logger, an is configured with the @alt-javascript/cookies/Cookies qualifier by default when using with @alt-javascript/boot

May be freely distributed under the MIT license.

Copyright (c) 2021-2022 Craig Parravicini

About

Simple utility to ease the use of browser cookies

Resources

License

Stars

Watchers

Forks

Packages

No packages published