@alt-javascript/cookies

1.0.1 • Public • Published

Simple utility to ease the use of browser cookies.

NPM
Language Badge Package Badge
release notes

Introduction

Simple utility to ease the use of browser cookies.

Usage

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

License

May be freely distributed under the MIT license.

Copyright (c) 2021-2022 Craig Parravicini

Readme

Keywords

Package Sidebar

Install

npm i @alt-javascript/cookies

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

16.2 kB

Total Files

14

Last publish

Collaborators

  • craigparra