Universal cookie for browsers and React Native. The scenario that cross-cookie really shines is when the same javascript codebase needs to run on different platforms.
- Platform agnostic: browsers or React Native
- Simple interface: no instantiation, no configuration and no extra dependency
Table of Contents
Install
npm install --save cross-cookie
// Using ES6 modules; // Using CommonJS modulesconst cookie = ;
The UMD build is also available on unpkg:
This adds the "cookie" object to the window.
Usage
const cookie = ; // Store current usercookie ; // Store multiple userscookie ; // Get current usercookie ; // Get multiple userscookie ; // Remove current usercookie ; // Clear all keyscookie ;
⚠️ Warning: If you're in an environment that doesn't support Promises such as Internet Explorer, you must install an ES6 Promise compatible polyfill. es6-promise is suggested.
Demo
Try it out on the JSFiddle playground ➡️.
Supported environments
- React-Native
- Browsers
- Chrome
- Firefox
- Safari 6.1+
- Internet Explorer 10+
License
cross-cookie is licenced under the MIT license © Leonardo Quixadá
Author
@lquixada |