@whitesev/utils 2.8.2 → 2.9.0
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.
- package/README.md +176 -176
- package/dist/index.amd.js +269 -777
- package/dist/index.amd.js.map +1 -1
- package/dist/index.amd.min.js +2 -0
- package/dist/index.amd.min.js.map +1 -0
- package/dist/index.cjs.js +269 -777
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.cjs.min.js +2 -0
- package/dist/index.cjs.min.js.map +1 -0
- package/dist/index.esm.js +269 -777
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +2 -0
- package/dist/index.esm.min.js.map +1 -0
- package/dist/index.iife.js +269 -777
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +2 -0
- package/dist/index.iife.min.js.map +1 -0
- package/dist/index.system.js +269 -777
- package/dist/index.system.js.map +1 -1
- package/dist/index.system.min.js +2 -0
- package/dist/index.system.min.js.map +1 -0
- package/dist/index.umd.js +269 -777
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +2 -0
- package/dist/index.umd.min.js.map +1 -0
- package/dist/types/src/Utils.d.ts +103 -450
- package/dist/types/src/UtilsGMCookie.d.ts +4 -0
- package/dist/types/src/UtilsGMMenu.d.ts +3 -6
- package/dist/types/src/types/Httpx.d.ts +1344 -1344
- package/dist/types/src/types/Log.d.ts +19 -19
- package/dist/types/src/types/Progress.d.ts +20 -20
- package/dist/types/src/types/React.d.ts +119 -119
- package/dist/types/src/types/TryCatch.d.ts +9 -9
- package/dist/types/src/types/UtilsGMCookie.d.ts +93 -93
- package/dist/types/src/types/UtilsGMMenu.d.ts +77 -77
- package/dist/types/src/types/Vue2.d.ts +166 -166
- package/dist/types/src/types/WindowApi.d.ts +14 -14
- package/dist/types/src/types/ajaxHooker.d.ts +151 -151
- package/dist/types/src/types/env.d.ts +7 -7
- package/dist/types/src/types/global.d.ts +31 -31
- package/package.json +13 -9
- package/src/ColorConversion.ts +105 -105
- package/src/CommonUtil.ts +280 -280
- package/src/DOMUtils.ts +251 -251
- package/src/Dictionary.ts +153 -153
- package/src/GBKEncoder.ts +108 -108
- package/src/Hooks.ts +73 -73
- package/src/Httpx.ts +1457 -1457
- package/src/LockFunction.ts +62 -62
- package/src/Log.ts +258 -258
- package/src/Progress.ts +108 -108
- package/src/TryCatch.ts +86 -86
- package/src/Utils.ts +3778 -4773
- package/src/UtilsCommon.ts +14 -14
- package/src/UtilsGMCookie.ts +272 -254
- package/src/UtilsGMMenu.ts +441 -445
- package/src/Vue.ts +233 -233
- package/src/WindowApi.ts +59 -59
- package/src/indexedDB.ts +497 -497
- package/src/types/Httpx.d.ts +1344 -1344
- package/src/types/Log.d.ts +19 -19
- package/src/types/Progress.d.ts +20 -20
- package/src/types/React.d.ts +119 -119
- package/src/types/TryCatch.d.ts +9 -9
- package/src/types/UtilsGMCookie.d.ts +93 -93
- package/src/types/UtilsGMMenu.d.ts +77 -77
- package/src/types/Vue2.d.ts +166 -166
- package/src/types/WindowApi.d.ts +14 -14
- package/src/types/ajaxHooker.d.ts +151 -151
- package/src/types/env.d.ts +7 -7
- package/src/types/global.d.ts +31 -31
- package/dist/types/src/types/Event.d.ts +0 -188
- package/src/types/Event.d.ts +0 -188
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/** Utils.Log的初始化配置 */
|
|
2
|
-
export interface UtilsLogOptions {
|
|
3
|
-
/** 是否输出Tag,false的话其它的颜色也不输出 @default true */
|
|
4
|
-
tag: boolean;
|
|
5
|
-
/** log.success的颜色 @default "#0000FF" */
|
|
6
|
-
successColor: string;
|
|
7
|
-
/** log.warn的颜色 @default "0" */
|
|
8
|
-
warnColor: string;
|
|
9
|
-
/** log.error的颜色 @default "#FF0000" */
|
|
10
|
-
errorColor: string;
|
|
11
|
-
/** log.info的颜色 @default "0" */
|
|
12
|
-
infoColor: string;
|
|
13
|
-
/** 是否开启debug模式,true会在控制台每次调用时输出调用函数的所在位置,false不会输出位置 @default false */
|
|
14
|
-
debug: boolean;
|
|
15
|
-
/** 当console输出超过logMaxCount数量自动清理控制台 @default false */
|
|
16
|
-
autoClearConsole: boolean;
|
|
17
|
-
/** console输出的最高数量,autoClearConsole开启则生效 @default 999 */
|
|
18
|
-
logMaxCount: number;
|
|
19
|
-
}
|
|
1
|
+
/** Utils.Log的初始化配置 */
|
|
2
|
+
export interface UtilsLogOptions {
|
|
3
|
+
/** 是否输出Tag,false的话其它的颜色也不输出 @default true */
|
|
4
|
+
tag: boolean;
|
|
5
|
+
/** log.success的颜色 @default "#0000FF" */
|
|
6
|
+
successColor: string;
|
|
7
|
+
/** log.warn的颜色 @default "0" */
|
|
8
|
+
warnColor: string;
|
|
9
|
+
/** log.error的颜色 @default "#FF0000" */
|
|
10
|
+
errorColor: string;
|
|
11
|
+
/** log.info的颜色 @default "0" */
|
|
12
|
+
infoColor: string;
|
|
13
|
+
/** 是否开启debug模式,true会在控制台每次调用时输出调用函数的所在位置,false不会输出位置 @default false */
|
|
14
|
+
debug: boolean;
|
|
15
|
+
/** 当console输出超过logMaxCount数量自动清理控制台 @default false */
|
|
16
|
+
autoClearConsole: boolean;
|
|
17
|
+
/** console输出的最高数量,autoClearConsole开启则生效 @default 999 */
|
|
18
|
+
logMaxCount: number;
|
|
19
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export interface ProgressParamConfig {
|
|
2
|
-
/** canvas元素节点 */
|
|
3
|
-
canvasNode: HTMLCanvasElement;
|
|
4
|
-
/** 绘制角度,默认:95 */
|
|
5
|
-
deg: number;
|
|
6
|
-
/** 进度,默认:0 */
|
|
7
|
-
progress: number;
|
|
8
|
-
/** 绘制的线宽度,默认:10 */
|
|
9
|
-
lineWidth: number;
|
|
10
|
-
/** 绘制的背景颜色,默认:#1e637c */
|
|
11
|
-
lineBgColor: string;
|
|
12
|
-
/** 绘制的线的颜色,默认:#25deff */
|
|
13
|
-
lineColor: string;
|
|
14
|
-
/** 绘制的字体颜色,默认:#000000 */
|
|
15
|
-
textColor: string;
|
|
16
|
-
/** 绘制的字体大小(px),默认:22px */
|
|
17
|
-
fontSize: number;
|
|
18
|
-
/** 绘制的圆的半径,默认:50 */
|
|
19
|
-
circleRadius: number;
|
|
20
|
-
}
|
|
1
|
+
export interface ProgressParamConfig {
|
|
2
|
+
/** canvas元素节点 */
|
|
3
|
+
canvasNode: HTMLCanvasElement;
|
|
4
|
+
/** 绘制角度,默认:95 */
|
|
5
|
+
deg: number;
|
|
6
|
+
/** 进度,默认:0 */
|
|
7
|
+
progress: number;
|
|
8
|
+
/** 绘制的线宽度,默认:10 */
|
|
9
|
+
lineWidth: number;
|
|
10
|
+
/** 绘制的背景颜色,默认:#1e637c */
|
|
11
|
+
lineBgColor: string;
|
|
12
|
+
/** 绘制的线的颜色,默认:#25deff */
|
|
13
|
+
lineColor: string;
|
|
14
|
+
/** 绘制的字体颜色,默认:#000000 */
|
|
15
|
+
textColor: string;
|
|
16
|
+
/** 绘制的字体大小(px),默认:22px */
|
|
17
|
+
fontSize: number;
|
|
18
|
+
/** 绘制的圆的半径,默认:50 */
|
|
19
|
+
circleRadius: number;
|
|
20
|
+
}
|
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
export declare interface ReactFiberNode {
|
|
2
|
-
/**
|
|
3
|
-
* 指向当前节点在上一次更新时的对应节点。
|
|
4
|
-
*/
|
|
5
|
-
alternate: ReactFiberNode;
|
|
6
|
-
/**
|
|
7
|
-
* 指向该 FiberNode 的第一个子节点
|
|
8
|
-
*/
|
|
9
|
-
child: ReactFiberNode | null;
|
|
10
|
-
/**
|
|
11
|
-
* 代表子节点上的更新优先级。
|
|
12
|
-
*/
|
|
13
|
-
childLanes: number;
|
|
14
|
-
/**
|
|
15
|
-
* 存储节点的依赖信息,用于处理 useEffect 等情况。
|
|
16
|
-
*/
|
|
17
|
-
dependencies: any | null;
|
|
18
|
-
/**
|
|
19
|
-
* 大部分情况与 type 相同,某些情况不同,比如 FunctionComponent 使用 React.memo 包裹,表示元素的类型
|
|
20
|
-
*/
|
|
21
|
-
elementType: string;
|
|
22
|
-
/**
|
|
23
|
-
* 存储 FiberNode 的标记,表示节点上的各种状态和变化(删除、新增、替换等)。flags 的定义在 packages\react-reconciler\src\ReactFiberFlags.js 文件中,flags 为 number 类型。
|
|
24
|
-
*/
|
|
25
|
-
flags: number;
|
|
26
|
-
/**
|
|
27
|
-
* 当前节点在父节点的子节点列表中的索引
|
|
28
|
-
*/
|
|
29
|
-
index: number;
|
|
30
|
-
/**
|
|
31
|
-
* 节点的唯一标识符,用于进行节点的 diff 和更新
|
|
32
|
-
*/
|
|
33
|
-
key: any | null;
|
|
34
|
-
/**
|
|
35
|
-
* 代表当前节点上的更新优先级。
|
|
36
|
-
*/
|
|
37
|
-
lanes: number;
|
|
38
|
-
/**
|
|
39
|
-
* 表示节点上一次渲染的 props 。在完成本次更新之前,memoizedProps 中存储的是上一次渲染时的 props ,用于对比新旧 props 是否发生变化。
|
|
40
|
-
*/
|
|
41
|
-
memoizedProps: any;
|
|
42
|
-
/**
|
|
43
|
-
* 类组件保存上次渲染后的 state ,函数组件保存的 hooks 信息。
|
|
44
|
-
*/
|
|
45
|
-
memoizedState: any | null;
|
|
46
|
-
/**
|
|
47
|
-
* 表示节点的模式,如 ConcurrentMode 、StrictMode 等。
|
|
48
|
-
*/
|
|
49
|
-
mode: number;
|
|
50
|
-
/**
|
|
51
|
-
* 表示即将被应用到节点的 props 。当父组件发生更新时,会将新的 props 存储在 pendingProps 中,之后会被应用到节点。
|
|
52
|
-
*/
|
|
53
|
-
pendingProps: any;
|
|
54
|
-
/**
|
|
55
|
-
* 存储 FiberNode 的引用信息,与 React 的 Ref 有关。使用 ref 引用值
|
|
56
|
-
*/
|
|
57
|
-
ref: any | null;
|
|
58
|
-
/**
|
|
59
|
-
* 指向该 FiberNode 的父节点
|
|
60
|
-
*/
|
|
61
|
-
return: ReactFiberNode | null;
|
|
62
|
-
/**
|
|
63
|
-
* 指向右边第一个兄弟 Fiber 节点
|
|
64
|
-
*/
|
|
65
|
-
sibling: ReactFiberNode | null;
|
|
66
|
-
/**
|
|
67
|
-
* FiberNode 对应的真实 DOM 节点
|
|
68
|
-
*/
|
|
69
|
-
stateNode: HTMLElement;
|
|
70
|
-
/**
|
|
71
|
-
* 表示节点类型的标记,例如 FunctionComponent 、ClassComponent 等
|
|
72
|
-
*/
|
|
73
|
-
tag: number;
|
|
74
|
-
/**
|
|
75
|
-
* 表示元素的类型, 对于 FunctionComponent,指函数本身,对于ClassComponent,指 class,对于 HostComponent,指 DOM 节点 tagName
|
|
76
|
-
*/
|
|
77
|
-
type: string;
|
|
78
|
-
/**
|
|
79
|
-
* 用于存储组件的更新状态,比如新的状态、属性或者 context 的变化。通过 updateQueue ,React 可以跟踪组件的更新并在合适的时机执行更新。
|
|
80
|
-
*/
|
|
81
|
-
updateQueue: any;
|
|
82
|
-
[key: string | symbol | number]: any;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export declare interface ReactProps {
|
|
86
|
-
$$typeof: symbol;
|
|
87
|
-
children: ReactProps;
|
|
88
|
-
key: string | null;
|
|
89
|
-
ref: any;
|
|
90
|
-
props: ReactProps;
|
|
91
|
-
type: string;
|
|
92
|
-
_owner: any;
|
|
93
|
-
[key: string | symbol | number]: any;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export declare interface ReactEvents {
|
|
97
|
-
[key: string | symbol | number]: any;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export declare interface ReactEventHandlers {
|
|
101
|
-
[key: string | symbol | number]: any;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export declare interface ReactInternalInstance {
|
|
105
|
-
[key: string | symbol | number]: any;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export declare interface ReactContainer {
|
|
109
|
-
[key: string | symbol | number]: any;
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export declare interface ReactInstance {
|
|
113
|
-
reactFiber?: ReactFiberNode;
|
|
114
|
-
reactProps?: ReactProps;
|
|
115
|
-
reactEvents?: ReactEvents;
|
|
116
|
-
reactEventHandlers?: ReactEventHandlers;
|
|
117
|
-
reactInternalInstance?: ReactInternalInstance;
|
|
118
|
-
reactContainer?: ReactContainer;
|
|
119
|
-
}
|
|
1
|
+
export declare interface ReactFiberNode {
|
|
2
|
+
/**
|
|
3
|
+
* 指向当前节点在上一次更新时的对应节点。
|
|
4
|
+
*/
|
|
5
|
+
alternate: ReactFiberNode;
|
|
6
|
+
/**
|
|
7
|
+
* 指向该 FiberNode 的第一个子节点
|
|
8
|
+
*/
|
|
9
|
+
child: ReactFiberNode | null;
|
|
10
|
+
/**
|
|
11
|
+
* 代表子节点上的更新优先级。
|
|
12
|
+
*/
|
|
13
|
+
childLanes: number;
|
|
14
|
+
/**
|
|
15
|
+
* 存储节点的依赖信息,用于处理 useEffect 等情况。
|
|
16
|
+
*/
|
|
17
|
+
dependencies: any | null;
|
|
18
|
+
/**
|
|
19
|
+
* 大部分情况与 type 相同,某些情况不同,比如 FunctionComponent 使用 React.memo 包裹,表示元素的类型
|
|
20
|
+
*/
|
|
21
|
+
elementType: string;
|
|
22
|
+
/**
|
|
23
|
+
* 存储 FiberNode 的标记,表示节点上的各种状态和变化(删除、新增、替换等)。flags 的定义在 packages\react-reconciler\src\ReactFiberFlags.js 文件中,flags 为 number 类型。
|
|
24
|
+
*/
|
|
25
|
+
flags: number;
|
|
26
|
+
/**
|
|
27
|
+
* 当前节点在父节点的子节点列表中的索引
|
|
28
|
+
*/
|
|
29
|
+
index: number;
|
|
30
|
+
/**
|
|
31
|
+
* 节点的唯一标识符,用于进行节点的 diff 和更新
|
|
32
|
+
*/
|
|
33
|
+
key: any | null;
|
|
34
|
+
/**
|
|
35
|
+
* 代表当前节点上的更新优先级。
|
|
36
|
+
*/
|
|
37
|
+
lanes: number;
|
|
38
|
+
/**
|
|
39
|
+
* 表示节点上一次渲染的 props 。在完成本次更新之前,memoizedProps 中存储的是上一次渲染时的 props ,用于对比新旧 props 是否发生变化。
|
|
40
|
+
*/
|
|
41
|
+
memoizedProps: any;
|
|
42
|
+
/**
|
|
43
|
+
* 类组件保存上次渲染后的 state ,函数组件保存的 hooks 信息。
|
|
44
|
+
*/
|
|
45
|
+
memoizedState: any | null;
|
|
46
|
+
/**
|
|
47
|
+
* 表示节点的模式,如 ConcurrentMode 、StrictMode 等。
|
|
48
|
+
*/
|
|
49
|
+
mode: number;
|
|
50
|
+
/**
|
|
51
|
+
* 表示即将被应用到节点的 props 。当父组件发生更新时,会将新的 props 存储在 pendingProps 中,之后会被应用到节点。
|
|
52
|
+
*/
|
|
53
|
+
pendingProps: any;
|
|
54
|
+
/**
|
|
55
|
+
* 存储 FiberNode 的引用信息,与 React 的 Ref 有关。使用 ref 引用值
|
|
56
|
+
*/
|
|
57
|
+
ref: any | null;
|
|
58
|
+
/**
|
|
59
|
+
* 指向该 FiberNode 的父节点
|
|
60
|
+
*/
|
|
61
|
+
return: ReactFiberNode | null;
|
|
62
|
+
/**
|
|
63
|
+
* 指向右边第一个兄弟 Fiber 节点
|
|
64
|
+
*/
|
|
65
|
+
sibling: ReactFiberNode | null;
|
|
66
|
+
/**
|
|
67
|
+
* FiberNode 对应的真实 DOM 节点
|
|
68
|
+
*/
|
|
69
|
+
stateNode: HTMLElement;
|
|
70
|
+
/**
|
|
71
|
+
* 表示节点类型的标记,例如 FunctionComponent 、ClassComponent 等
|
|
72
|
+
*/
|
|
73
|
+
tag: number;
|
|
74
|
+
/**
|
|
75
|
+
* 表示元素的类型, 对于 FunctionComponent,指函数本身,对于ClassComponent,指 class,对于 HostComponent,指 DOM 节点 tagName
|
|
76
|
+
*/
|
|
77
|
+
type: string;
|
|
78
|
+
/**
|
|
79
|
+
* 用于存储组件的更新状态,比如新的状态、属性或者 context 的变化。通过 updateQueue ,React 可以跟踪组件的更新并在合适的时机执行更新。
|
|
80
|
+
*/
|
|
81
|
+
updateQueue: any;
|
|
82
|
+
[key: string | symbol | number]: any;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export declare interface ReactProps {
|
|
86
|
+
$$typeof: symbol;
|
|
87
|
+
children: ReactProps;
|
|
88
|
+
key: string | null;
|
|
89
|
+
ref: any;
|
|
90
|
+
props: ReactProps;
|
|
91
|
+
type: string;
|
|
92
|
+
_owner: any;
|
|
93
|
+
[key: string | symbol | number]: any;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export declare interface ReactEvents {
|
|
97
|
+
[key: string | symbol | number]: any;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export declare interface ReactEventHandlers {
|
|
101
|
+
[key: string | symbol | number]: any;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export declare interface ReactInternalInstance {
|
|
105
|
+
[key: string | symbol | number]: any;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export declare interface ReactContainer {
|
|
109
|
+
[key: string | symbol | number]: any;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export declare interface ReactInstance {
|
|
113
|
+
reactFiber?: ReactFiberNode;
|
|
114
|
+
reactProps?: ReactProps;
|
|
115
|
+
reactEvents?: ReactEvents;
|
|
116
|
+
reactEventHandlers?: ReactEventHandlers;
|
|
117
|
+
reactInternalInstance?: ReactInternalInstance;
|
|
118
|
+
reactContainer?: ReactContainer;
|
|
119
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare interface UtilsTryCatchConfig {
|
|
2
|
-
log: boolean;
|
|
3
|
-
}
|
|
4
|
-
/** tryCatch */
|
|
5
|
-
export declare interface UtilsTryCatchType {
|
|
6
|
-
run: UtilsTryCatchType;
|
|
7
|
-
config: UtilsTryCatchType;
|
|
8
|
-
error: UtilsTryCatchType;
|
|
9
|
-
}
|
|
1
|
+
export declare interface UtilsTryCatchConfig {
|
|
2
|
+
log: boolean;
|
|
3
|
+
}
|
|
4
|
+
/** tryCatch */
|
|
5
|
+
export declare interface UtilsTryCatchType {
|
|
6
|
+
run: UtilsTryCatchType;
|
|
7
|
+
config: UtilsTryCatchType;
|
|
8
|
+
error: UtilsTryCatchType;
|
|
9
|
+
}
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
export interface UtilsGMCookieResult {
|
|
2
|
-
/** 为 window.location.hostname */
|
|
3
|
-
domain: string;
|
|
4
|
-
/** 过期时间 */
|
|
5
|
-
expirationDate: null;
|
|
6
|
-
hostOnly: true;
|
|
7
|
-
httpOnly: false;
|
|
8
|
-
/** Cookie名 */
|
|
9
|
-
name: string;
|
|
10
|
-
/** Cookie的路径 */
|
|
11
|
-
path: "/";
|
|
12
|
-
/** Cookie是否同源策略 */
|
|
13
|
-
sameSite: "unspecified";
|
|
14
|
-
secure: true;
|
|
15
|
-
session: false;
|
|
16
|
-
/** Cookie值 */
|
|
17
|
-
value: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface UtilsGMCookieListOptions {
|
|
21
|
-
/** 默认为当前的url */
|
|
22
|
-
url?: string;
|
|
23
|
-
/**
|
|
24
|
-
* Cookie所在域
|
|
25
|
-
* @default window.location.hostname
|
|
26
|
-
*/
|
|
27
|
-
domain?: string;
|
|
28
|
-
/** 需要检索的Cookie的名字 */
|
|
29
|
-
name: string | RegExp;
|
|
30
|
-
/**
|
|
31
|
-
* 需要检索的Cookie的路径
|
|
32
|
-
* @default "/"
|
|
33
|
-
*/
|
|
34
|
-
path?: string;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export interface UtilsGMCookieSetOptions {
|
|
38
|
-
/**
|
|
39
|
-
* 默认为当前的url
|
|
40
|
-
*/
|
|
41
|
-
url?: string;
|
|
42
|
-
/**
|
|
43
|
-
* Cookie所在域
|
|
44
|
-
*
|
|
45
|
-
* 不填的话会默认在window.location.hostname的前面加上.
|
|
46
|
-
*/
|
|
47
|
-
domain?: string;
|
|
48
|
-
/** 需要检索的Cookie的名字 */
|
|
49
|
-
name: string;
|
|
50
|
-
/**
|
|
51
|
-
* 需要检索的Cookie的路径
|
|
52
|
-
* @default "/"
|
|
53
|
-
*/
|
|
54
|
-
path?: string;
|
|
55
|
-
/** Cookie值 */
|
|
56
|
-
value: string | number;
|
|
57
|
-
/**
|
|
58
|
-
* 确保Cookie只在通过安全协议(如HTTPS)的情况下传输
|
|
59
|
-
* @default true
|
|
60
|
-
*/
|
|
61
|
-
secure?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* 是否防止JavaScript代码访问Cookie
|
|
64
|
-
* @default false
|
|
65
|
-
*/
|
|
66
|
-
httpOnly?: boolean;
|
|
67
|
-
/**
|
|
68
|
-
* Cookie过期时间的时间戳,默认为30天
|
|
69
|
-
* @default Math.floor(Date.now()) + 60 * 60 * 24 * 30
|
|
70
|
-
*/
|
|
71
|
-
expirationDate?: number;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export interface UtilsGMCookieDeleteOptions {
|
|
75
|
-
/** 需要检索的Cookie的名字 */
|
|
76
|
-
name: string;
|
|
77
|
-
/** 默认为当前的url */
|
|
78
|
-
url?: string;
|
|
79
|
-
/**
|
|
80
|
-
* Cookie的路径
|
|
81
|
-
* @default "/"
|
|
82
|
-
*/
|
|
83
|
-
path?: string;
|
|
84
|
-
/**
|
|
85
|
-
* Cookie所在域
|
|
86
|
-
*/
|
|
87
|
-
firstPartyDomain?: string;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export interface WindowApiOption {
|
|
91
|
-
window: Window & typeof globalThis;
|
|
92
|
-
document: Document;
|
|
93
|
-
}
|
|
1
|
+
export interface UtilsGMCookieResult {
|
|
2
|
+
/** 为 window.location.hostname */
|
|
3
|
+
domain: string;
|
|
4
|
+
/** 过期时间 */
|
|
5
|
+
expirationDate: null;
|
|
6
|
+
hostOnly: true;
|
|
7
|
+
httpOnly: false;
|
|
8
|
+
/** Cookie名 */
|
|
9
|
+
name: string;
|
|
10
|
+
/** Cookie的路径 */
|
|
11
|
+
path: "/";
|
|
12
|
+
/** Cookie是否同源策略 */
|
|
13
|
+
sameSite: "unspecified";
|
|
14
|
+
secure: true;
|
|
15
|
+
session: false;
|
|
16
|
+
/** Cookie值 */
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UtilsGMCookieListOptions {
|
|
21
|
+
/** 默认为当前的url */
|
|
22
|
+
url?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Cookie所在域
|
|
25
|
+
* @default window.location.hostname
|
|
26
|
+
*/
|
|
27
|
+
domain?: string;
|
|
28
|
+
/** 需要检索的Cookie的名字 */
|
|
29
|
+
name: string | RegExp;
|
|
30
|
+
/**
|
|
31
|
+
* 需要检索的Cookie的路径
|
|
32
|
+
* @default "/"
|
|
33
|
+
*/
|
|
34
|
+
path?: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface UtilsGMCookieSetOptions {
|
|
38
|
+
/**
|
|
39
|
+
* 默认为当前的url
|
|
40
|
+
*/
|
|
41
|
+
url?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Cookie所在域
|
|
44
|
+
*
|
|
45
|
+
* 不填的话会默认在window.location.hostname的前面加上.
|
|
46
|
+
*/
|
|
47
|
+
domain?: string;
|
|
48
|
+
/** 需要检索的Cookie的名字 */
|
|
49
|
+
name: string;
|
|
50
|
+
/**
|
|
51
|
+
* 需要检索的Cookie的路径
|
|
52
|
+
* @default "/"
|
|
53
|
+
*/
|
|
54
|
+
path?: string;
|
|
55
|
+
/** Cookie值 */
|
|
56
|
+
value: string | number;
|
|
57
|
+
/**
|
|
58
|
+
* 确保Cookie只在通过安全协议(如HTTPS)的情况下传输
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
secure?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* 是否防止JavaScript代码访问Cookie
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
httpOnly?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Cookie过期时间的时间戳,默认为30天
|
|
69
|
+
* @default Math.floor(Date.now()) + 60 * 60 * 24 * 30
|
|
70
|
+
*/
|
|
71
|
+
expirationDate?: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface UtilsGMCookieDeleteOptions {
|
|
75
|
+
/** 需要检索的Cookie的名字 */
|
|
76
|
+
name: string;
|
|
77
|
+
/** 默认为当前的url */
|
|
78
|
+
url?: string;
|
|
79
|
+
/**
|
|
80
|
+
* Cookie的路径
|
|
81
|
+
* @default "/"
|
|
82
|
+
*/
|
|
83
|
+
path?: string;
|
|
84
|
+
/**
|
|
85
|
+
* Cookie所在域
|
|
86
|
+
*/
|
|
87
|
+
firstPartyDomain?: string;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export interface WindowApiOption {
|
|
91
|
+
window: Window & typeof globalThis;
|
|
92
|
+
document: Document;
|
|
93
|
+
}
|