1.1 --- a/README Wed Oct 17 00:37:54 2007 -0400
1.2 +++ b/README Wed Oct 17 00:40:09 2007 -0400
1.3 @@ -3,8 +3,8 @@
1.4
1.5 Simple JavaScript cookie handling API.
1.6
1.7 -Usage
1.8 -=====
1.9 +Using EasyCookie
1.10 +================
1.11 Get a cookie:
1.12
1.13 val = EasyCookie.get('some_key');
2.1 --- a/easy_cookie.js Wed Oct 17 00:37:54 2007 -0400
2.2 +++ b/easy_cookie.js Wed Oct 17 00:40:09 2007 -0400
2.3 @@ -1,6 +1,52 @@
2.4 /*
2.5 * EasyCookie - an easy Javascript cookie handling interface.
2.6 *
2.7 + * Usaging EasyCookie
2.8 + * ==================
2.9 + * Get a cookie:
2.10 + *
2.11 + * val = EasyCookie.get('some_key');
2.12 + *
2.13 + * Set a cookie:
2.14 + *
2.15 + * val = 'this is a test string';
2.16 + * EasyCookie.get('some_key', val);
2.17 + *
2.18 + * Remove a cookie:
2.19 + *
2.20 + * old_val = EasyCookie.remove('some_key');
2.21 + *
2.22 + * Check to see if cookies are enabled:
2.23 + *
2.24 + * status = EasyCookie.enabled ? 'enabled' : 'not enabled';
2.25 + * alert('Cookies are ' + status);
2.26 + *
2.27 + * Set also has several optional parameters, which can be passed like so:
2.28 + *
2.29 + * val = 'this is a test string';
2.30 + * EasyCookie.set('some_key', val, {
2.31 + * // expires in 10 days
2.32 + * expires: 10,
2.33 + *
2.34 + * // limit cookie to domain 'foo.example.com'
2.35 + * domain: 'foo.example.com',
2.36 + *
2.37 + * // limit cookie to path '/some/path'
2.38 + * path: '/some/path',
2.39 + *
2.40 + * // restrict cookie to secure pages only
2.41 + * secure: true
2.42 + * });
2.43 + *
2.44 + * You can also get a list of existing cookies like so:
2.45 + *
2.46 + * // get an array of cookie names
2.47 + * keys = EasyCookie.keys();
2.48 + *
2.49 + * See test/test.js for examples of all methods.
2.50 + *
2.51 + * License
2.52 + * =======
2.53 * Copyright (C) 2007 Paul Duncan <pabs@pablotron.org>
2.54 *
2.55 * All rights reserved.