@whitesev/utils 1.3.4 → 1.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,30 @@ declare interface UtilsGMCookieListOptions {
21
21
  /** 需要检索的Cookie的路径,默认为"/" */
22
22
  path: string;
23
23
  }
24
+ declare interface UtilsGMCookieSetOptions {
25
+ /** 默认为当前的url */
26
+ url?: string;
27
+ /** 默认为当前的域名(window.location.hostname) */
28
+ domain?: string;
29
+ /** 需要检索的Cookie的名字 */
30
+ name?: string;
31
+ /** 需要检索的Cookie的路径,默认为"/" */
32
+ path?: string;
33
+ /** 值 */
34
+ value?: string | number;
35
+ /** 确保Cookie只在通过安全协议(如HTTPS)的情况下传输 */
36
+ secure?: boolean;
37
+ /** 是否防止JavaScript代码访问Cookie */
38
+ httpOnly?: boolean;
39
+ /** Cookie过期时间,默认为30天 */
40
+ expirationDate?: number;
41
+ }
42
+ declare interface UtilsGMCookieDeleteOptions {
43
+ /** 默认为当前的url */
44
+ url: string;
45
+ /** 需要检索的Cookie的名字 */
46
+ name: string;
47
+ }
24
48
  declare class UtilsGMCookie {
25
49
  /**
26
50
  * 获取单个cookie
@@ -45,12 +69,12 @@ declare class UtilsGMCookie {
45
69
  * @param paramDetails 配置
46
70
  * @param callback 设置操作后的回调(成功/失败)
47
71
  */
48
- set(paramDetails: Partial<UtilsGMCookieListOptions>, callback?: (error?: Error) => void): void;
72
+ set(paramDetails: Partial<UtilsGMCookieSetOptions>, callback?: (error?: Error) => void): void;
49
73
  /**
50
74
  * 删除Cookie
51
75
  * @param paramDetails 配置
52
76
  * @param callback 删除操作后的回调(成功/失败)
53
77
  */
54
- delete(paramDetails: Partial<UtilsGMCookieListOptions>, callback?: (error?: Error) => void): void;
78
+ delete(paramDetails: Partial<UtilsGMCookieDeleteOptions>, callback?: (error?: Error) => void): void;
55
79
  }
56
80
  export { UtilsGMCookie };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whitesev/utils",
3
- "version": "1.3.4",
3
+ "version": "1.3.5",
4
4
  "description": "一个常用的工具库",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/node/index.esm.js",
@@ -197,7 +197,7 @@ class UtilsGMCookie {
197
197
  * @param callback 设置操作后的回调(成功/失败)
198
198
  */
199
199
  set(
200
- paramDetails: Partial<UtilsGMCookieListOptions>,
200
+ paramDetails: Partial<UtilsGMCookieSetOptions>,
201
201
  callback = (error?: Error) => {}
202
202
  ) {
203
203
  try {
@@ -237,7 +237,7 @@ class UtilsGMCookie {
237
237
  * @param callback 删除操作后的回调(成功/失败)
238
238
  */
239
239
  delete(
240
- paramDetails: Partial<UtilsGMCookieListOptions>,
240
+ paramDetails: Partial<UtilsGMCookieDeleteOptions>,
241
241
  callback = (error?: Error) => {}
242
242
  ) {
243
243
  try {