0.7.1 • Published 10 years ago

tongs v0.7.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

tongs npm version Build Status

cookie utility. don't dependency jquery.

motivation

jquery-cookie is awsome!! but jquery ....

Build Status Matrix

Sauce Test Status

Install

browser

Download here

<script src="/path/to/tongs.js"></script>

npm

npm install tongs
var tongs = require('tongs');

Usage

Set cookie:

tongs().cookie('name', 'value');

Set cookie with option:

tongs().cookie('name', 'value', {expires: 7, path: '/'});

Get Cookie:

tongs().cookie('name'); // => value
tongs().cookie('nothing'); // => undefined

Get all available cookies:

// document.cookie => name1=value1, name2=value2
tongs().cookie();
// => [{name1: value1}, {name2: value2}]

Remove Cookie:

tongs().remove('name'); // => true
tongs().remove('nothing'); // => false

//with option
tongs().cookie('path_cookie', 'value', {path: '/'});
tongs().remove('path_cookie'); // => false
tongs().remove('path_cookie', {path: '/'}); // => true

Get wide domain

// location.hostname => dl.dropboxusercontent.com
tongs().wideDomain(); // => .dropboxusercontent.com

ex) use cookie across the subdomain

var set_domain = tongs().wideDomain();
tongs().cookie('name', 'valkue', {domain: set_domain});
0.7.1

10 years ago

0.7.0

10 years ago

0.6.3

10 years ago

0.6.2

10 years ago

0.6.1

10 years ago

0.6.0

10 years ago

0.5.2

10 years ago