|
1 | | -# cookies |
2 | | -Simple utility to ease the use of browser cookies |
| 1 | +A Simple Log Facade for JavaScript |
| 2 | +=================================== |
| 3 | + |
| 4 | +[](https://nodei.co/npm/@alt-javascript/logger/) |
| 5 | +<br/> |
| 6 | + |
| 7 | + <br/> |
| 8 | +[release notes](https://github.com/craigparra/alt-logger/blob/main/History.md) |
| 9 | + |
| 10 | +<a name="intro">Introduction</a> |
| 11 | +-------------------------------- |
| 12 | +Simple utility to ease the use of browser cookies. |
| 13 | + |
| 14 | +<a name="usage">Usage</a> |
| 15 | +------------------------- |
| 16 | + |
| 17 | + |
| 18 | +The module is also able to be used directly in the browser, as an IIFE (Immediately Invoked Function Expression), |
| 19 | +as follows: |
| 20 | + |
| 21 | +```html |
| 22 | + <script src="https://cdn.jsdelivr.net/npm/@alt-javascript/cookies/dist/alt-javascript-cookies-iife.js"></script> |
| 23 | + |
| 24 | + <script> |
| 25 | + cookies.setCookie('somecookie','giveitavalue',365,'Strict');// expires in 365 days, SameSite == Strict (default) |
| 26 | + cookies.getCookie('somecookie'); |
| 27 | + cookies.deleteCookie("somecookie"); |
| 28 | + </script> |
| 29 | +``` |
| 30 | + |
| 31 | +Or import the ES6 module bundle from a module, as follows: |
| 32 | + |
| 33 | +```javascript |
| 34 | +import { Cookies } from 'https://cdn.jsdelivr.net/npm/@alt-javascript/cookies' |
| 35 | + |
| 36 | +let cookies = new Cookies(); |
| 37 | + |
| 38 | +//...as above |
| 39 | +``` |
| 40 | + |
| 41 | +### Logger |
| 42 | + |
| 43 | +The Cookies class optionally accepts an @alt-javascript/logger, an is configured with the '@alt-javascript/cookies/Cookies' |
| 44 | +qualifier by default when using with @alt-javascript/boot |
| 45 | + |
| 46 | +<a name="license">License</a> |
| 47 | +----------------------------- |
| 48 | + |
| 49 | +May be freely distributed under the [MIT license](https://raw.githubusercontent.com/alt-javascript/cookies/main/LICENSE). |
| 50 | + |
| 51 | +Copyright (c) 2021-2022 Craig Parravicini |
0 commit comments