Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 1.76 KB

README.md

File metadata and controls

51 lines (35 loc) · 1.76 KB

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