ugooki / cookie-storage

A Web Storage interface for Cookie

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cookie-storage

A Web Storage interface for Cookie.

Installation

$ bower install cookie-storage

or

$ npm install cookie-storage

Usage

window.cookieStorage = new CookieStorage();

// Web Storage interface
cookieStorage.length === 0;

cookieStorage.setItem('key', 'value');
cookieStorage.length === 1;
cookieStorage.key(0) === 'key';

cookieStorage.getItem('key') === 'value';
cookieStorage.removeItem('key');
cookieStorage.length === 0;

cookieStorage.setItem('k1', 'v1');
cookieStorage.setItem('k2', 'v2');
cookieStorage.length === 2;

cookieStorage.clear();
cookieStorage.length === 0;

// Cookie options
cookieStorage.setItem('key', 'value', {
  path: '/',
  domain: 'example.com',
  expires: new Date(),
  secure: true
});

Development

See npm run.

License

MIT

Author

bouzuya <m@bouzuya.net> (http://bouzuya.net)

Status

Build Status

About

A Web Storage interface for Cookie

License:MIT License


Languages

Language:JavaScript 65.4%Language:CoffeeScript 34.6%