一个轻量、简单、易于使用的cookie管理库
cookie-manager为管理cookie提供简易的方法。
- 没有依赖
- 支持AMD,CommonJS,Node modules
- 仅1KB大小
- 兼容所有浏览器
使用npm安装
npm install @psyduck4u/cookie-manager
下载cookie-manager.min.js
在你的项目中引入即可。
<script src="cookie-manager.min.js"></script>
import CookieManager from '@psyduck4u/cookie-manager';
或者在引入cookie-manager.min.js
之后,你就可以使用CookieManager
对象了。
CookieManager.set(name, value, expires, domain, path, secure);
name (String)
cookie namevalue (String)
cookie valueexpires (Optional) (String)
cookie expiration in daysdomain (Optional) (String)
cookie domainpath (Optional) (String)
cookie pathname (Optional) (Boolean)
cookie ssl support flag
CookieManager.get(name);
name (String)
cookie name
CookieManager.update(name, value, expires, domain, path, secure);
name (String)
cookie namevalue (String)
cookie valueexpires (Optional) (String)
cookie expiration in daysdomain (Optional) (String)
cookie domainpath (Optional) (String)
cookie pathname (Optional) (Boolean)
cookie ssl support flag
CookieManager.remove(name);
name (String)
cookie name
CookieManager.getAll();
CookieManager.clear();
Created and maintained by Yuxiang Yang under MIT License