mazey 4.0.6 → 4.1.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/LICENSE +21 -21
- package/README.md +990 -990
- package/coverage/clover.xml +1238 -0
- package/coverage/coverage-final.json +2 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.esm.js.html +12646 -0
- package/coverage/lcov-report/index.html +116 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +2548 -0
- package/lib/browser.d.ts +90 -0
- package/lib/browser.d.ts.map +1 -0
- package/lib/calc.d.ts +106 -0
- package/lib/calc.d.ts.map +1 -0
- package/lib/debug.d.ts +40 -0
- package/lib/debug.d.ts.map +1 -0
- package/lib/dom.d.ts +164 -0
- package/lib/dom.d.ts.map +1 -0
- package/lib/event.d.ts +76 -0
- package/lib/event.d.ts.map +1 -0
- package/lib/global.d.ts +87 -0
- package/lib/index.cjs.js +2 -2
- package/lib/index.d.ts +10 -2040
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +2 -2
- package/lib/load.d.ts +169 -0
- package/lib/load.d.ts.map +1 -0
- package/lib/mazey.min.js +2 -2
- package/lib/perf.d.ts +199 -0
- package/lib/perf.d.ts.map +1 -0
- package/lib/store.d.ts +216 -0
- package/lib/store.d.ts.map +1 -0
- package/lib/typing.d.ts +88 -74
- package/lib/url.d.ts +246 -0
- package/lib/url.d.ts.map +1 -0
- package/lib/util.d.ts +841 -0
- package/lib/util.d.ts.map +1 -0
- package/package.json +124 -122
- package/scripts/README.md +0 -38
- package/scripts/build-helper.js +0 -76
- package/scripts/dev.js +0 -23
- package/scripts/env-win.sh +0 -2
- package/scripts/git-helper.js +0 -155
- package/scripts/mac-build.sh +0 -8
- package/scripts/release.js +0 -9
- package/scripts/rollup.config.mjs +0 -152
package/lib/perf.d.ts
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import type { WebPerformance } from "./typing";
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
export declare function isSupportedEntryType(name: string): boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Gets the first contentful paint (FCP) time of a web page using the Performance API.
|
|
8
|
+
* The FCP time is the time it takes for the first piece of content to be painted on the screen.
|
|
9
|
+
*
|
|
10
|
+
* Usage:
|
|
11
|
+
*
|
|
12
|
+
* ```javascript
|
|
13
|
+
* getFCP().then(
|
|
14
|
+
* res => {
|
|
15
|
+
* console.log(`FCP: ${res}`);
|
|
16
|
+
* }
|
|
17
|
+
* );
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* Output:
|
|
21
|
+
*
|
|
22
|
+
* ```text
|
|
23
|
+
* FCP: 123
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @returns A promise that resolves with the FCP time in milliseconds, or 0 if the 'paint' entry type is not supported.
|
|
27
|
+
* @category Perf
|
|
28
|
+
*/
|
|
29
|
+
export declare function getFCP(): Promise<number>;
|
|
30
|
+
/**
|
|
31
|
+
* Gets the first paint (FP) time of a web page using the Performance API.
|
|
32
|
+
* The FP time is the time it takes for the first pixel to be painted on the screen.
|
|
33
|
+
*
|
|
34
|
+
* Usage:
|
|
35
|
+
*
|
|
36
|
+
* ```javascript
|
|
37
|
+
* getFP().then(
|
|
38
|
+
* res => {
|
|
39
|
+
* console.log(`FP: ${res}`);
|
|
40
|
+
* }
|
|
41
|
+
* );
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* Output:
|
|
45
|
+
*
|
|
46
|
+
* ```text
|
|
47
|
+
* FP: 123
|
|
48
|
+
* ```
|
|
49
|
+
*
|
|
50
|
+
* @returns A promise that resolves with the FP time in milliseconds, or 0 if the 'paint' entry type is not supported.
|
|
51
|
+
* @category Perf
|
|
52
|
+
*/
|
|
53
|
+
export declare function getFP(): Promise<number>;
|
|
54
|
+
/**
|
|
55
|
+
* Gets the largest contentful paint (LCP) time of a web page using the Performance API.
|
|
56
|
+
* The LCP time is the time it takes for the largest piece of content to be painted on the screen.
|
|
57
|
+
*
|
|
58
|
+
* Usage:
|
|
59
|
+
*
|
|
60
|
+
* ```javascript
|
|
61
|
+
* getLCP().then(
|
|
62
|
+
* res => {
|
|
63
|
+
* console.log(`LCP: ${res}`);
|
|
64
|
+
* }
|
|
65
|
+
* );
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* Output:
|
|
69
|
+
*
|
|
70
|
+
* ```text
|
|
71
|
+
* LCP: 123
|
|
72
|
+
* ```
|
|
73
|
+
*
|
|
74
|
+
* @returns A promise that resolves with the LCP time in milliseconds, or 0 if the 'largest-contentful-paint' entry type is not supported.
|
|
75
|
+
* @category Perf
|
|
76
|
+
*/
|
|
77
|
+
export declare function getLCP(): Promise<number>;
|
|
78
|
+
/**
|
|
79
|
+
* Gets the first input delay (FID) of a web page using the Performance API.
|
|
80
|
+
* The FID is the time it takes for the first user input to be processed by the browser.
|
|
81
|
+
*
|
|
82
|
+
* Usage:
|
|
83
|
+
*
|
|
84
|
+
* ```javascript
|
|
85
|
+
* getFID().then(
|
|
86
|
+
* res => {
|
|
87
|
+
* console.log(`FID: ${res}`);
|
|
88
|
+
* }
|
|
89
|
+
* );
|
|
90
|
+
* ```
|
|
91
|
+
*
|
|
92
|
+
* Output:
|
|
93
|
+
*
|
|
94
|
+
* ```text
|
|
95
|
+
* FID: 123
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* @returns A promise that resolves with the FID in milliseconds, or 0 if the 'first-input' entry type is not supported.
|
|
99
|
+
* @category Perf
|
|
100
|
+
*/
|
|
101
|
+
export declare function getFID(): Promise<number>;
|
|
102
|
+
/**
|
|
103
|
+
* Gets the Cumulative Layout Shift (CLS) score of a web page using the Performance API.
|
|
104
|
+
* The CLS score is a measure of how much the page layout shifts during loading.
|
|
105
|
+
*
|
|
106
|
+
* Usage:
|
|
107
|
+
*
|
|
108
|
+
* ```javascript
|
|
109
|
+
* getCLS().then(
|
|
110
|
+
* res => {
|
|
111
|
+
* console.log(`CLS: ${res}`);
|
|
112
|
+
* }
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* Output:
|
|
117
|
+
*
|
|
118
|
+
* ```text
|
|
119
|
+
* CLS: 123
|
|
120
|
+
* ```
|
|
121
|
+
*
|
|
122
|
+
* @returns A promise that resolves with the CLS score, or 0 if the 'layout-shift' entry type is not supported.
|
|
123
|
+
* @category Perf
|
|
124
|
+
*/
|
|
125
|
+
export declare function getCLS(): Promise<number>;
|
|
126
|
+
/**
|
|
127
|
+
* Gets the time to first byte (TTFB) of a web page using the Performance API.
|
|
128
|
+
* The TTFB is the time it takes for the first byte of the response to be received by the browser.
|
|
129
|
+
*
|
|
130
|
+
* Usage:
|
|
131
|
+
*
|
|
132
|
+
* ```javascript
|
|
133
|
+
* getTTFB().then(
|
|
134
|
+
* res => {
|
|
135
|
+
* console.log(`TTFB: ${res}`);
|
|
136
|
+
* }
|
|
137
|
+
* );
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* Output:
|
|
141
|
+
*
|
|
142
|
+
* ```text
|
|
143
|
+
* TTFB: 123
|
|
144
|
+
* ```
|
|
145
|
+
*
|
|
146
|
+
* @returns The TTFB in milliseconds, or 0 if the navigation timing information is not available.
|
|
147
|
+
* @category Perf
|
|
148
|
+
*/
|
|
149
|
+
export declare function getTTFB(): Promise<number>;
|
|
150
|
+
/**
|
|
151
|
+
* EN: Get page load time(`PerformanceNavigationTiming`).
|
|
152
|
+
*
|
|
153
|
+
* ZH: 获取页面加载相关的各项数据
|
|
154
|
+
*
|
|
155
|
+
* @remarks
|
|
156
|
+
* This function uses the [`PerformanceNavigationTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming) API to get page load time data.
|
|
157
|
+
* The `PerformanceNavigationTiming` API provides more accurate and detailed information about page load time than the deprecated [`PerformanceTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceTiming) API.
|
|
158
|
+
* If you are using an older browser that does not support `PerformanceNavigationTiming`, you can still use the `PerformanceTiming` API by using the previous version of this library ([`v3.9.7`](https://github.com/mazeyqian/mazey/releases/tag/v3.9.7)).
|
|
159
|
+
*
|
|
160
|
+
* Usage:
|
|
161
|
+
*
|
|
162
|
+
* ```javascript
|
|
163
|
+
* // `camelCase:false` (Default) Return underline(`a_b`) data.
|
|
164
|
+
* // `camelCase:true` Return hump(`aB`) data.
|
|
165
|
+
* getPerformance()
|
|
166
|
+
* .then(res => {
|
|
167
|
+
* console.log(JSON.stringify(res));
|
|
168
|
+
* })
|
|
169
|
+
* .catch(console.error);
|
|
170
|
+
* ```
|
|
171
|
+
*
|
|
172
|
+
* Output:
|
|
173
|
+
*
|
|
174
|
+
* ```text
|
|
175
|
+
* {"source":"PerformanceNavigationTiming","os":"others","os_version":"","device_type":"pc","network":"4g","screen_direction":"","unload_time":0,"redirect_time":0,"dns_time":0,"tcp_time":0,"ssl_time":0,"response_time":2,"download_time":2,"first_paint_time":288,"first_contentful_paint_time":288,"dom_ready_time":0,"onload_time":0,"white_time":0,"render_time":0,"decoded_body_size":718,"encoded_body_size":718}
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* Results:
|
|
179
|
+
*
|
|
180
|
+
* | Attribute | Description | Type | Values |
|
|
181
|
+
* | :------------ | :------------ | :------------ | :------------ |
|
|
182
|
+
* | dns_time | DNS Lookup | number | domainLookupEnd - domainLookupStart |
|
|
183
|
+
* | tcp_time | Connection Negotiation | number | connectEnd - connectStart |
|
|
184
|
+
* | response_time | Requests and Responses | number | responseStart - requestStart |
|
|
185
|
+
* | white_time | White Screen | number | responseStart - navigationStart |
|
|
186
|
+
* | dom_ready_time | Dom Ready | number | domContentLoadedEventStart - navigationStart |
|
|
187
|
+
* | onload_time | Onload | number | loadEventStart - navigationStart |
|
|
188
|
+
* | render_time | EventEnd | number | loadEventEnd -navigationStart |
|
|
189
|
+
* | unload_time | Unload | number | (Optional) unloadEventEnd - unloadEventStart |
|
|
190
|
+
* | redirect_time | Redirect | number | (Optional) redirectEnd - redirectStart |
|
|
191
|
+
* | ssl_time | SSL | number | (Optional) connectEnd - secureConnectionStart |
|
|
192
|
+
* | download_time | Download | number | (Optional) responseEnd - responseStart |
|
|
193
|
+
*
|
|
194
|
+
* @param {boolean} camelCase -- false(默认) 以下划线形式返回数据 true 以驼峰形式返回数据
|
|
195
|
+
* @returns {Promise<object>} 加载数据
|
|
196
|
+
* @category Perf
|
|
197
|
+
*/
|
|
198
|
+
export declare function getPerformance(camelCase?: boolean): Promise<WebPerformance | Error>;
|
|
199
|
+
//# sourceMappingURL=perf.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perf.d.ts","sourceRoot":"","sources":["../src/perf.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,WAUhD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAe9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAe7C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAe9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAoB9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAmB9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAc/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,wBAAsB,cAAc,CAAC,SAAS,UAAQ,GAAG,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CA8QvF"}
|
package/lib/store.d.ts
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
3
|
+
*
|
|
4
|
+
* ZH: 存储/获取数据到 sessionStorage/localStorage
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
*
|
|
8
|
+
* ```javascript
|
|
9
|
+
* setSessionStorage('test', '123');
|
|
10
|
+
* const ret1 = getSessionStorage('test');
|
|
11
|
+
* setLocalStorage('test', '123');
|
|
12
|
+
* const ret2 = getLocalStorage('test');
|
|
13
|
+
* console.log(ret1, ret2);
|
|
14
|
+
*
|
|
15
|
+
* // or package in usage
|
|
16
|
+
* const projectName = 'mazey';
|
|
17
|
+
* function mSetLocalStorage (key, value) {
|
|
18
|
+
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* function mGetLocalStorage (key) {
|
|
22
|
+
* return getLocalStorage(`${projectName}_${key}`);
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* Output:
|
|
27
|
+
*
|
|
28
|
+
* ```text
|
|
29
|
+
* 123 123
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @param {string} key 键
|
|
33
|
+
* @returns {void} 返回值
|
|
34
|
+
* @category Store
|
|
35
|
+
*/
|
|
36
|
+
export declare function setSessionStorage<T>(key: string, value?: T | null): void;
|
|
37
|
+
/**
|
|
38
|
+
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
39
|
+
*
|
|
40
|
+
* ZH: 存储/获取数据到 sessionStorage/localStorage
|
|
41
|
+
*
|
|
42
|
+
* Usage:
|
|
43
|
+
*
|
|
44
|
+
* ```javascript
|
|
45
|
+
* setSessionStorage('test', '123');
|
|
46
|
+
* const ret1 = getSessionStorage('test');
|
|
47
|
+
* setLocalStorage('test', '123');
|
|
48
|
+
* const ret2 = getLocalStorage('test');
|
|
49
|
+
* console.log(ret1, ret2);
|
|
50
|
+
*
|
|
51
|
+
* // or package in usage
|
|
52
|
+
* const projectName = 'mazey';
|
|
53
|
+
* function mSetLocalStorage (key, value) {
|
|
54
|
+
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
55
|
+
* }
|
|
56
|
+
*
|
|
57
|
+
* function mGetLocalStorage (key) {
|
|
58
|
+
* return getLocalStorage(`${projectName}_${key}`);
|
|
59
|
+
* }
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* Output:
|
|
63
|
+
*
|
|
64
|
+
* ```text
|
|
65
|
+
* 123 123
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @param {string} key 键
|
|
69
|
+
* @returns {any} 返回值
|
|
70
|
+
* @category Store
|
|
71
|
+
*/
|
|
72
|
+
export declare function getSessionStorage<T>(key: string): T | null;
|
|
73
|
+
/**
|
|
74
|
+
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
75
|
+
*
|
|
76
|
+
* ZH: 存储/获取数据到 sessionStorage/localStorage
|
|
77
|
+
*
|
|
78
|
+
* Usage:
|
|
79
|
+
*
|
|
80
|
+
* ```javascript
|
|
81
|
+
* setSessionStorage('test', '123');
|
|
82
|
+
* const ret1 = getSessionStorage('test');
|
|
83
|
+
* setLocalStorage('test', '123');
|
|
84
|
+
* const ret2 = getLocalStorage('test');
|
|
85
|
+
* console.log(ret1, ret2);
|
|
86
|
+
*
|
|
87
|
+
* // or package in usage
|
|
88
|
+
* const projectName = 'mazey';
|
|
89
|
+
* function mSetLocalStorage (key, value) {
|
|
90
|
+
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
91
|
+
* }
|
|
92
|
+
*
|
|
93
|
+
* function mGetLocalStorage (key) {
|
|
94
|
+
* return getLocalStorage(`${projectName}_${key}`);
|
|
95
|
+
* }
|
|
96
|
+
* ```
|
|
97
|
+
*
|
|
98
|
+
* Output:
|
|
99
|
+
*
|
|
100
|
+
* ```text
|
|
101
|
+
* 123 123
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @param {string} key 键
|
|
105
|
+
* @returns {void} 返回值
|
|
106
|
+
* @category Store
|
|
107
|
+
*/
|
|
108
|
+
export declare function setLocalStorage<T>(key: string, value?: T | null): void;
|
|
109
|
+
/**
|
|
110
|
+
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
111
|
+
*
|
|
112
|
+
* ZH: 存储/获取数据到 sessionStorage/localStorage
|
|
113
|
+
*
|
|
114
|
+
* Usage:
|
|
115
|
+
*
|
|
116
|
+
* ```javascript
|
|
117
|
+
* setSessionStorage('test', '123');
|
|
118
|
+
* const ret1 = getSessionStorage('test');
|
|
119
|
+
* setLocalStorage('test', '123');
|
|
120
|
+
* const ret2 = getLocalStorage('test');
|
|
121
|
+
* console.log(ret1, ret2);
|
|
122
|
+
*
|
|
123
|
+
* // or package in usage
|
|
124
|
+
* const projectName = 'mazey';
|
|
125
|
+
* function mSetLocalStorage (key, value) {
|
|
126
|
+
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
127
|
+
* }
|
|
128
|
+
*
|
|
129
|
+
* function mGetLocalStorage (key) {
|
|
130
|
+
* return getLocalStorage(`${projectName}_${key}`);
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*
|
|
134
|
+
* Output:
|
|
135
|
+
*
|
|
136
|
+
* ```text
|
|
137
|
+
* 123 123
|
|
138
|
+
* ```
|
|
139
|
+
*
|
|
140
|
+
* @param {string} key 键
|
|
141
|
+
* @returns {void} 返回值
|
|
142
|
+
* @category Store
|
|
143
|
+
*/
|
|
144
|
+
export declare function getLocalStorage<T>(key: string): T | null;
|
|
145
|
+
/**
|
|
146
|
+
* EN: Handle Cookie.
|
|
147
|
+
*
|
|
148
|
+
* ZH: 设置/获取 Cookie
|
|
149
|
+
*
|
|
150
|
+
* Usage:
|
|
151
|
+
*
|
|
152
|
+
* ```javascript
|
|
153
|
+
* setCookie('test', '123', 30, 'example.com'); // key value day domain
|
|
154
|
+
* const ret = getCookie('test');
|
|
155
|
+
* console.log(ret);
|
|
156
|
+
* ```
|
|
157
|
+
*
|
|
158
|
+
* Output:
|
|
159
|
+
*
|
|
160
|
+
* ```text
|
|
161
|
+
* 123
|
|
162
|
+
* ```
|
|
163
|
+
*
|
|
164
|
+
* @category Store
|
|
165
|
+
*/
|
|
166
|
+
export declare function getCookie(name: string): string;
|
|
167
|
+
/**
|
|
168
|
+
* EN: Handle Cookie.
|
|
169
|
+
*
|
|
170
|
+
* ZH: 设置/获取 Cookie
|
|
171
|
+
*
|
|
172
|
+
* Usage:
|
|
173
|
+
*
|
|
174
|
+
* ```javascript
|
|
175
|
+
* setCookie('test', '123', 30, 'example.com'); // key value day domain
|
|
176
|
+
* const ret = getCookie('test');
|
|
177
|
+
* console.log(ret);
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* Output:
|
|
181
|
+
*
|
|
182
|
+
* ```text
|
|
183
|
+
* 123
|
|
184
|
+
* ```
|
|
185
|
+
*
|
|
186
|
+
* @category Store
|
|
187
|
+
*/
|
|
188
|
+
export declare function setCookie(name: string, value: string, days?: number, domain?: string): void;
|
|
189
|
+
/**
|
|
190
|
+
* Delete a cookie by name.
|
|
191
|
+
*
|
|
192
|
+
* Usage:
|
|
193
|
+
*
|
|
194
|
+
* ```javascript
|
|
195
|
+
* const ret = removeCookie('test');
|
|
196
|
+
* console.log(ret);
|
|
197
|
+
* ```
|
|
198
|
+
*
|
|
199
|
+
* Output:
|
|
200
|
+
*
|
|
201
|
+
* ```text
|
|
202
|
+
* true
|
|
203
|
+
* ```
|
|
204
|
+
*
|
|
205
|
+
* @param name - The name of the cookie to delete.
|
|
206
|
+
* @returns `true` if the cookie was deleted successfully, `false` otherwise.
|
|
207
|
+
* @category Store
|
|
208
|
+
*/
|
|
209
|
+
export declare function removeCookie(name: string): boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Alias of `removeCookie`.
|
|
212
|
+
*
|
|
213
|
+
* @hidden
|
|
214
|
+
*/
|
|
215
|
+
export declare function delCookie(name: string): void;
|
|
216
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,CAAC,GAAG,IAAW,GAAG,IAAI,CAI9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAS1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,CAAC,GAAG,IAAW,GAAG,IAAI,CAI5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CASxD;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW9C;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAmC3F;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAclD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C"}
|
package/lib/typing.d.ts
CHANGED
|
@@ -1,76 +1,90 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @author Cheng
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
interface BrowserInfo {
|
|
6
|
-
engine: string; // webkit gecko presto trident
|
|
7
|
-
engineVs: string;
|
|
8
|
-
platform: string; // desktop mobile
|
|
9
|
-
supporter: string; // chrome safari firefox opera iexplore edge
|
|
10
|
-
supporterVs: string;
|
|
11
|
-
system: string; // windows macos linux android ios
|
|
12
|
-
systemVs: string;
|
|
13
|
-
shell?: string; // wechat qq uc 360 2345 sougou liebao maxthon
|
|
14
|
-
shellVs?: string;
|
|
15
|
-
appleType?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface DefineListeners {
|
|
19
|
-
[key: string]: any;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
type TestUa = (regexp: RegExp) => boolean;
|
|
23
|
-
type TestVs = (regexp: RegExp) => string;
|
|
24
|
-
|
|
25
|
-
interface UrlParams {
|
|
26
|
-
[key: string]: string[];
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
type ThrottleFunc<T extends (...args: any[]) => any> = (...args: Parameters<T>) => ReturnType<T> | null;
|
|
30
|
-
|
|
31
|
-
type DebounceFunc<T extends (...args: any[]) => any> = (...args: Parameters<T>) => ReturnType<T>;
|
|
32
|
-
|
|
33
|
-
interface IsNumberOptions {
|
|
34
|
-
isNaNAsNumber?: boolean;
|
|
35
|
-
isInfinityAsNumber?: boolean;
|
|
36
|
-
isUnFiniteAsNumber?: boolean;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
type AnyFunction = (...args: any[]) => any;
|
|
40
|
-
|
|
41
|
-
interface ZResResponse {
|
|
42
|
-
status: number;
|
|
43
|
-
data: {
|
|
44
|
-
code: number;
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
interface ZResIsValidResOptions {
|
|
49
|
-
validStatusRange?: [number, number];
|
|
50
|
-
validCode?: number[];
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
interface RepeatUntilOptions {
|
|
54
|
-
interval?: number;
|
|
55
|
-
times?: number;
|
|
56
|
-
context?: any;
|
|
57
|
-
args?: Array<any>;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
type LoadScriptReturns = Promise<boolean | string | Error | void>;
|
|
61
|
-
|
|
62
|
-
type SimpleType = string | number | boolean | null | undefined;
|
|
63
|
-
type SimpleObject = {
|
|
64
|
-
[key: string]: SimpleType | SimpleType[] | SimpleObject | SimpleObject[];
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
type UnknownObject = any; // Record<string, unknown>;
|
|
68
|
-
type UnknownFnParams = any[]; // | Record<string, unknown> | string | number | boolean | null | undefined;
|
|
69
|
-
type UnknownFnReturn = any;
|
|
70
|
-
type UnknownFn = (...args: UnknownFnParams) => UnknownFnReturn;
|
|
71
|
-
|
|
72
|
-
interface UnknownWindow {
|
|
73
|
-
[key: string]: any;
|
|
1
|
+
/**
|
|
2
|
+
* @author Cheng
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
interface BrowserInfo {
|
|
6
|
+
engine: string; // webkit gecko presto trident
|
|
7
|
+
engineVs: string;
|
|
8
|
+
platform: string; // desktop mobile
|
|
9
|
+
supporter: string; // chrome safari firefox opera iexplore edge
|
|
10
|
+
supporterVs: string;
|
|
11
|
+
system: string; // windows macos linux android ios
|
|
12
|
+
systemVs: string;
|
|
13
|
+
shell?: string; // wechat qq uc 360 2345 sougou liebao maxthon
|
|
14
|
+
shellVs?: string;
|
|
15
|
+
appleType?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
interface DefineListeners {
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
type TestUa = (regexp: RegExp) => boolean;
|
|
23
|
+
type TestVs = (regexp: RegExp) => string;
|
|
24
|
+
|
|
25
|
+
interface UrlParams {
|
|
26
|
+
[key: string]: string[];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
type ThrottleFunc<T extends (...args: any[]) => any> = (...args: Parameters<T>) => ReturnType<T> | null;
|
|
30
|
+
|
|
31
|
+
type DebounceFunc<T extends (...args: any[]) => any> = (...args: Parameters<T>) => ReturnType<T>;
|
|
32
|
+
|
|
33
|
+
interface IsNumberOptions {
|
|
34
|
+
isNaNAsNumber?: boolean;
|
|
35
|
+
isInfinityAsNumber?: boolean;
|
|
36
|
+
isUnFiniteAsNumber?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
type AnyFunction = (...args: any[]) => any;
|
|
40
|
+
|
|
41
|
+
interface ZResResponse {
|
|
42
|
+
status: number;
|
|
43
|
+
data: {
|
|
44
|
+
code: number;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
interface ZResIsValidResOptions {
|
|
49
|
+
validStatusRange?: [number, number];
|
|
50
|
+
validCode?: number[];
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
interface RepeatUntilOptions {
|
|
54
|
+
interval?: number;
|
|
55
|
+
times?: number;
|
|
56
|
+
context?: any;
|
|
57
|
+
args?: Array<any>;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
type LoadScriptReturns = Promise<boolean | string | Error | void>;
|
|
61
|
+
|
|
62
|
+
type SimpleType = string | number | boolean | null | undefined;
|
|
63
|
+
type SimpleObject = {
|
|
64
|
+
[key: string]: SimpleType | SimpleType[] | SimpleObject | SimpleObject[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
type UnknownObject = any; // Record<string, unknown>;
|
|
68
|
+
type UnknownFnParams = any[]; // | Record<string, unknown> | string | number | boolean | null | undefined;
|
|
69
|
+
type UnknownFnReturn = any;
|
|
70
|
+
type UnknownFn = (...args: UnknownFnParams) => UnknownFnReturn;
|
|
71
|
+
|
|
72
|
+
interface UnknownWindow {
|
|
73
|
+
[key: string]: any;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
type MazeyObject = any; // Record<string, unknown>;
|
|
77
|
+
type MazeyFnParams = any[]; // | Record<string, unknown> | string | number | boolean | null | undefined;
|
|
78
|
+
type MazeyFnReturn = any;
|
|
79
|
+
type MazeyFunction = (...args: any[]) => any;
|
|
80
|
+
type MazeyFn = (...args: UnknownFnParams) => UnknownFnReturn;
|
|
81
|
+
|
|
82
|
+
interface MazeyWindow {
|
|
83
|
+
[key: string]: any;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
interface WebPerformance {
|
|
87
|
+
[key: string]: string | number;
|
|
74
88
|
}
|
|
75
89
|
|
|
76
|
-
export type { AnyFunction, BrowserInfo, DebounceFunc, DefineListeners, IsNumberOptions, LoadScriptReturns, RepeatUntilOptions, SimpleObject, SimpleType, TestUa, TestVs, ThrottleFunc, UnknownFn, UnknownFnParams, UnknownFnReturn, UnknownObject, UnknownWindow, UrlParams, ZResIsValidResOptions, ZResResponse };
|
|
90
|
+
export type { AnyFunction, BrowserInfo, DebounceFunc, DefineListeners, IsNumberOptions, LoadScriptReturns, MazeyFn, MazeyFnParams, MazeyFnReturn, MazeyFunction, MazeyObject, MazeyWindow, RepeatUntilOptions, SimpleObject, SimpleType, TestUa, TestVs, ThrottleFunc, UnknownFn, UnknownFnParams, UnknownFnReturn, UnknownObject, UnknownWindow, UrlParams, WebPerformance, ZResIsValidResOptions, ZResResponse };
|