pablotron / easy-cookie Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
EasyCookie 0.2.1 README ======================= Simple JavaScript cookie library. EasyCookie is licensed under the revised BSD license; please see the file COPYING for details. The latest version of EasyCookie can be found at http://pablotron.org/software/easy_cookie Using EasyCookie ================ Get a cookie: val = EasyCookie.get('some_key'); Set a cookie: val = 'this is a test string'; EasyCookie.get('some_key', val); Remove a cookie: old_val = EasyCookie.remove('some_key'); Check to see if cookies are enabled: status = EasyCookie.enabled ? 'enabled' : 'not enabled'; alert('Cookies are ' + status); Set also has several optional parameters, which can be passed like so: val = 'this is a test string'; EasyCookie.set('some_key', val, { // expires in 10 days expires: 10, // limit cookie to domain 'foo.example.com' domain: 'foo.example.com', // limit cookie to path '/some/path' path: '/some/path', // restrict cookie to secure pages only secure: true }); You can also get a list of existing cookies like so: // get an array of cookie names keys = EasyCookie.keys(); See test/test.js for examples of all methods. Notes ===== The file "easy_cookie-min.js" is functionally identical to "easy_cookie.js" and has been shrunk to about 1900 bytes using Douglas Crockford's excellent Javascript minifier, which can be found at the following URL: http://crockford.com/javascript/jsmin.html Embedding EasyCookie in an existing Javascript library is easy. EasyCookie only exposes one reference in the global namespace (the top-level EasyCookie object), and that can be easily embedded in an existing API by editing easy_cookie.js (or easy_cookie-min.js) and replacing the very first EasyCookie = with something else, for example: // definition of ExampleProject namespace ExampleProject = {}; // more stuff here ... // definition in easycookie.js ExampleProject.EasyCookie = (function() { About the Author ================ Paul Duncan <[email protected]> http://pablotron.org/
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.