elo7-cookie-amd
Version:
Browser cookie management
53 lines (33 loc) • 1.22 kB
Markdown
_Cookie-amd browser cookie library_
Cookie.js is a library that manipulates browser cookie. This library uses [amd](http://en.wikipedia.org/wiki/Asynchronous_module_definition) structure.
[](https://travis-ci.org/elo7/cookie-amd)
Install with [Npm](https://www.npmjs.com/): `npm install elo7-cookie-amd`
Cookie-amd depends on an [amd](http://en.wikipedia.org/wiki/Asynchronous_module_definition) implementation. We suggest [define-async](https://www.npmjs.com/package/define-async) implementation for dependency lookup.
`.get(name)`
Returns a the cookie value.
``` js
define(['cookie'], function(cookie) {
cookie.get('cookie-name');
});
```
`.set(name, value, days)`
Creates or rewrite a cookie value with a defined expiration time in days.
``` js
define(['cookie'], function(cookie) {
cookie.set('cookie-name', 'value', 1);
});
```
Cookie-amd is released under the [BSD](https://github.com/elo7/cookie-amd/blob/master/LICENSE). Have at it.
* * *
Copyright :copyright: 2015 Elo7