mazey 4.10.0 → 4.11.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/.dockerignore +35 -0
- package/.gitattributes +5 -0
- package/.markdownlint.json +48 -0
- package/AGENTS.md +111 -0
- package/Dockerfile +30 -0
- package/README.md +146 -69
- package/lib/global.d.ts +0 -2
- package/lib/index.cjs.js +2 -2
- package/lib/index.esm.js +2 -2
- package/lib/mazey.min.js +2 -2
- package/lib/typing.d.ts +22 -1
- package/package.json +3 -2
- package/scripts/change-package-name.js +6 -4
- package/scripts/git-helper.js +13 -12
- package/scripts/release.js +1 -1
- package/scripts/rollup.config.mjs +5 -1
- package/lib/browser.d.ts +0 -124
- package/lib/browser.d.ts.map +0 -1
- package/lib/calc.d.ts +0 -117
- package/lib/calc.d.ts.map +0 -1
- package/lib/debug.d.ts +0 -74
- package/lib/debug.d.ts.map +0 -1
- package/lib/dom.d.ts +0 -232
- package/lib/dom.d.ts.map +0 -1
- package/lib/event.d.ts +0 -101
- package/lib/event.d.ts.map +0 -1
- package/lib/index.d.ts +0 -14
- package/lib/index.d.ts.map +0 -1
- package/lib/load.d.ts +0 -186
- package/lib/load.d.ts.map +0 -1
- package/lib/perf.d.ts +0 -213
- package/lib/perf.d.ts.map +0 -1
- package/lib/store.d.ts +0 -230
- package/lib/store.d.ts.map +0 -1
- package/lib/url.d.ts +0 -394
- package/lib/url.d.ts.map +0 -1
- package/lib/util.d.ts +0 -1174
- package/lib/util.d.ts.map +0 -1
package/lib/load.d.ts
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
import type { MazeyFnParams, MazeyFnReturn, LoadScriptReturns } from "./typing";
|
|
2
|
-
/**
|
|
3
|
-
* EN: Load a CSS file from the server.
|
|
4
|
-
*
|
|
5
|
-
* ZH: 动态加载 CSS 文件。
|
|
6
|
-
*
|
|
7
|
-
* Usage:
|
|
8
|
-
*
|
|
9
|
-
* ```javascript
|
|
10
|
-
* import { loadCSS } from "mazey";
|
|
11
|
-
*
|
|
12
|
-
* loadCSS(
|
|
13
|
-
* "http://example.com/path/example.css",
|
|
14
|
-
* {
|
|
15
|
-
* id: "iamid", // Optional, link ID, default none
|
|
16
|
-
* }
|
|
17
|
-
* )
|
|
18
|
-
* .then(
|
|
19
|
-
* res => {
|
|
20
|
-
* console.log(`Load CSS Success: ${res}`);
|
|
21
|
-
* }
|
|
22
|
-
* )
|
|
23
|
-
* .catch(
|
|
24
|
-
* err => {
|
|
25
|
-
* console.error(`Load CSS Fail: ${err.message}`)
|
|
26
|
-
* }
|
|
27
|
-
* );
|
|
28
|
-
* ```
|
|
29
|
-
*
|
|
30
|
-
* Output:
|
|
31
|
-
*
|
|
32
|
-
* ```text
|
|
33
|
-
* Load CSS Success: loaded
|
|
34
|
-
* ```
|
|
35
|
-
*
|
|
36
|
-
* @param {string} url -- css资源路径
|
|
37
|
-
* @param {string} options.id -- link标签id
|
|
38
|
-
* @returns {Promise<string>} true -- 加载成功
|
|
39
|
-
* @category Load
|
|
40
|
-
*/
|
|
41
|
-
export declare function loadCSS(url: string, options?: {
|
|
42
|
-
id?: string;
|
|
43
|
-
}): Promise<unknown>;
|
|
44
|
-
/**
|
|
45
|
-
* EN: Load a JavaScript file from the server and execute it.
|
|
46
|
-
*
|
|
47
|
-
* ZH: 动态加载 JavaScript 文件。
|
|
48
|
-
*
|
|
49
|
-
* Usage:
|
|
50
|
-
*
|
|
51
|
-
* ```javascript
|
|
52
|
-
* import { loadScript } from "mazey";
|
|
53
|
-
*
|
|
54
|
-
* loadScript(
|
|
55
|
-
* "http://example.com/static/js/plugin-2.1.1.min.js",
|
|
56
|
-
* {
|
|
57
|
-
* id: "iamid", // (Optional) script ID, default none
|
|
58
|
-
* timeout: 5000, // (Optional) timeout, default `5000`
|
|
59
|
-
* }
|
|
60
|
-
* )
|
|
61
|
-
* .then(
|
|
62
|
-
* res => {
|
|
63
|
-
* console.log(`Load JavaScript script: ${res}`);
|
|
64
|
-
* }
|
|
65
|
-
* )
|
|
66
|
-
* .catch(
|
|
67
|
-
* err => {
|
|
68
|
-
* console.error(`Load JavaScript script: ${err.message}`);
|
|
69
|
-
* }
|
|
70
|
-
* );
|
|
71
|
-
* ```
|
|
72
|
-
*
|
|
73
|
-
* Output:
|
|
74
|
-
*
|
|
75
|
-
* ```text
|
|
76
|
-
* Load JavaScript script: loaded
|
|
77
|
-
* ```
|
|
78
|
-
*
|
|
79
|
-
* @param {string} url -- JavaScript 资源路径
|
|
80
|
-
* @param {string} options.id -- DOM ID
|
|
81
|
-
* @param {function} options.callback -- 加载后回调函数
|
|
82
|
-
* @param {number} options.timeout -- 超时时长
|
|
83
|
-
* @param {boolean} options.isDefer -- 是否添加 defer 标签
|
|
84
|
-
* @param {boolean} options.isAsync -- 是否添加 async 标签
|
|
85
|
-
* @param {boolean} options.isCrossOrigin -- 是否跨域
|
|
86
|
-
* @param {object} options.attributes -- 其他属性
|
|
87
|
-
* @param {string} options.cssUrl -- CSS 资源路径
|
|
88
|
-
* @returns {Promise<string>} -- true 成功
|
|
89
|
-
* @category Load
|
|
90
|
-
*/
|
|
91
|
-
export declare function loadScript(url: string, options?: {
|
|
92
|
-
id?: string;
|
|
93
|
-
callback?: (...params: MazeyFnParams) => MazeyFnReturn;
|
|
94
|
-
timeout?: number;
|
|
95
|
-
isDefer?: boolean;
|
|
96
|
-
isAsync?: boolean;
|
|
97
|
-
isCrossOrigin?: boolean;
|
|
98
|
-
attributes?: Record<string, string> | null;
|
|
99
|
-
cssUrl?: string;
|
|
100
|
-
}): LoadScriptReturns;
|
|
101
|
-
/**
|
|
102
|
-
* EN: Check whether the page is loaded successfully (Keep the compatibility if the browser's `load` event has been triggered).
|
|
103
|
-
*
|
|
104
|
-
* ZH: 页面加载完成。
|
|
105
|
-
*
|
|
106
|
-
* Usage:
|
|
107
|
-
*
|
|
108
|
-
* ```javascript
|
|
109
|
-
* import { windowLoaded } from "mazey";
|
|
110
|
-
*
|
|
111
|
-
* windowLoaded()
|
|
112
|
-
* .then(res => {
|
|
113
|
-
* console.log(`Load Success: ${res}`);
|
|
114
|
-
* })
|
|
115
|
-
* .catch(err => {
|
|
116
|
-
* console.log(`Load Timeout or Fail: ${err.message}`);
|
|
117
|
-
* });
|
|
118
|
-
* ```
|
|
119
|
-
*
|
|
120
|
-
* Output:
|
|
121
|
-
*
|
|
122
|
-
* ```text
|
|
123
|
-
* Load Success: load
|
|
124
|
-
* ```
|
|
125
|
-
*
|
|
126
|
-
* @param {number} timeout 超时时间 / 单位:毫秒,默认:30000(30 秒)
|
|
127
|
-
* @returns {Promise<string>} document is loaded? "complete" "load" / "timeout"
|
|
128
|
-
* @category Load
|
|
129
|
-
*/
|
|
130
|
-
export declare function windowLoaded(timeout?: number): Promise<string | Error>;
|
|
131
|
-
/**
|
|
132
|
-
* Load an image from the given URL.
|
|
133
|
-
*
|
|
134
|
-
* The target image will be loaded in the background, and the Promise status will change after the image is loaded. If the image fails to load, the Promise status will change to `reject` with the error object. If the image is loaded successfully, the Promise status will change to `resolve` with the image object. This method can be used to preload images and cache them in the browser. It can also be used to implement lazy loading of images.
|
|
135
|
-
*
|
|
136
|
-
* Note that this method will not add the image to the DOM.
|
|
137
|
-
*
|
|
138
|
-
* Usage:
|
|
139
|
-
*
|
|
140
|
-
* ```javascript
|
|
141
|
-
* import { loadImage } from "mazey";
|
|
142
|
-
*
|
|
143
|
-
* loadImage("https://example.com/example.png")
|
|
144
|
-
* .then((img) => {
|
|
145
|
-
* console.log(img);
|
|
146
|
-
* })
|
|
147
|
-
* .catch((err) => {
|
|
148
|
-
* console.log(err);
|
|
149
|
-
* });
|
|
150
|
-
* ```
|
|
151
|
-
*
|
|
152
|
-
* @param {string} url - The URL of the image to load.
|
|
153
|
-
* @returns {Promise} A Promise that resolves with the loaded image or rejects with an error.
|
|
154
|
-
* @category Load
|
|
155
|
-
*/
|
|
156
|
-
export declare function loadImage(url: string): Promise<HTMLImageElement>;
|
|
157
|
-
/**
|
|
158
|
-
* Load a script from the given URL if it (`window["attribute"]`) has not already been loaded.
|
|
159
|
-
*
|
|
160
|
-
* Usage:
|
|
161
|
-
*
|
|
162
|
-
* ```javascript
|
|
163
|
-
* import { loadScriptIfUndefined } from "mazey";
|
|
164
|
-
*
|
|
165
|
-
* loadScriptIfUndefined("xyz", "https://example.com/lib/xyz.min.js")
|
|
166
|
-
* .then(() => {
|
|
167
|
-
* console.log("xyz is loaded.");
|
|
168
|
-
* })
|
|
169
|
-
* .catch(err => {
|
|
170
|
-
* console.log("Failed to load xyz.", err);
|
|
171
|
-
* });
|
|
172
|
-
* ```
|
|
173
|
-
*
|
|
174
|
-
* Output:
|
|
175
|
-
*
|
|
176
|
-
* ```text
|
|
177
|
-
* xyz is loaded.
|
|
178
|
-
* ```
|
|
179
|
-
*
|
|
180
|
-
* @param {string} windowAttribute - The name of the window attribute to check (e.g. `jQuery`, `axios`, etc.).
|
|
181
|
-
* @param {string} url - The URL of the script to load.
|
|
182
|
-
* @returns {Promise} A Promise that resolves when the script has been loaded.
|
|
183
|
-
* @category Load
|
|
184
|
-
*/
|
|
185
|
-
export declare function loadScriptIfUndefined(windowAttribute: string, url: string): LoadScriptReturns;
|
|
186
|
-
//# sourceMappingURL=load.d.ts.map
|
package/lib/load.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../src/load.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAAE,aAAa,EAAE,iBAAiB,EAChD,MAAM,UAAU,CAAC;AAIlB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAyG5F;AAiCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,UAAU,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;IACP,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,aAAa,KAAK,aAAa,CAAC;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;IAC3C,MAAM,CAAC,EAAE,MAAM,CAAC;CAGjB,GACA,iBAAiB,CAgEnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,YAAY,CAAC,OAAO,SAAQ,GAAG,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAerE;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAWhE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,qBAAqB,CAAC,eAAe,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,iBAAiB,CAK7F"}
|
package/lib/perf.d.ts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
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
|
-
* import { getFCP } from "mazey";
|
|
14
|
-
*
|
|
15
|
-
* getFCP().then(
|
|
16
|
-
* res => {
|
|
17
|
-
* console.log(`FCP: ${res}`);
|
|
18
|
-
* }
|
|
19
|
-
* );
|
|
20
|
-
* ```
|
|
21
|
-
*
|
|
22
|
-
* Output:
|
|
23
|
-
*
|
|
24
|
-
* ```text
|
|
25
|
-
* FCP: 123
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* @returns A promise that resolves with the FCP time in milliseconds, or 0 if the "paint" entry type is not supported.
|
|
29
|
-
* @category Perf
|
|
30
|
-
*/
|
|
31
|
-
export declare function getFCP(): Promise<number>;
|
|
32
|
-
/**
|
|
33
|
-
* Gets the first paint (FP) time of a web page using the Performance API.
|
|
34
|
-
* The FP time is the time it takes for the first pixel to be painted on the screen.
|
|
35
|
-
*
|
|
36
|
-
* Usage:
|
|
37
|
-
*
|
|
38
|
-
* ```javascript
|
|
39
|
-
* import { getFP } from "mazey";
|
|
40
|
-
*
|
|
41
|
-
* getFP().then(
|
|
42
|
-
* res => {
|
|
43
|
-
* console.log(`FP: ${res}`);
|
|
44
|
-
* }
|
|
45
|
-
* );
|
|
46
|
-
* ```
|
|
47
|
-
*
|
|
48
|
-
* Output:
|
|
49
|
-
*
|
|
50
|
-
* ```text
|
|
51
|
-
* FP: 123
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @returns A promise that resolves with the FP time in milliseconds, or 0 if the "paint" entry type is not supported.
|
|
55
|
-
* @category Perf
|
|
56
|
-
*/
|
|
57
|
-
export declare function getFP(): Promise<number>;
|
|
58
|
-
/**
|
|
59
|
-
* Gets the largest contentful paint (LCP) time of a web page using the Performance API.
|
|
60
|
-
* The LCP time is the time it takes for the largest piece of content to be painted on the screen.
|
|
61
|
-
*
|
|
62
|
-
* Usage:
|
|
63
|
-
*
|
|
64
|
-
* ```javascript
|
|
65
|
-
* import { getLCP } from "mazey";
|
|
66
|
-
*
|
|
67
|
-
* getLCP().then(
|
|
68
|
-
* res => {
|
|
69
|
-
* console.log(`LCP: ${res}`);
|
|
70
|
-
* }
|
|
71
|
-
* );
|
|
72
|
-
* ```
|
|
73
|
-
*
|
|
74
|
-
* Output:
|
|
75
|
-
*
|
|
76
|
-
* ```text
|
|
77
|
-
* LCP: 123
|
|
78
|
-
* ```
|
|
79
|
-
*
|
|
80
|
-
* @returns A promise that resolves with the LCP time in milliseconds, or 0 if the "largest-contentful-paint" entry type is not supported.
|
|
81
|
-
* @category Perf
|
|
82
|
-
*/
|
|
83
|
-
export declare function getLCP(): Promise<number>;
|
|
84
|
-
/**
|
|
85
|
-
* Gets the first input delay (FID) of a web page using the Performance API.
|
|
86
|
-
* The FID is the time it takes for the first user input to be processed by the browser.
|
|
87
|
-
*
|
|
88
|
-
* Usage:
|
|
89
|
-
*
|
|
90
|
-
* ```javascript
|
|
91
|
-
* import { getFID } from "mazey";
|
|
92
|
-
*
|
|
93
|
-
* getFID().then(
|
|
94
|
-
* res => {
|
|
95
|
-
* console.log(`FID: ${res}`);
|
|
96
|
-
* }
|
|
97
|
-
* );
|
|
98
|
-
* ```
|
|
99
|
-
*
|
|
100
|
-
* Output:
|
|
101
|
-
*
|
|
102
|
-
* ```text
|
|
103
|
-
* FID: 123
|
|
104
|
-
* ```
|
|
105
|
-
*
|
|
106
|
-
* @returns A promise that resolves with the FID in milliseconds, or 0 if the "first-input" entry type is not supported.
|
|
107
|
-
* @category Perf
|
|
108
|
-
*/
|
|
109
|
-
export declare function getFID(): Promise<number>;
|
|
110
|
-
/**
|
|
111
|
-
* Gets the Cumulative Layout Shift (CLS) score of a web page using the Performance API.
|
|
112
|
-
* The CLS score is a measure of how much the page layout shifts during loading.
|
|
113
|
-
*
|
|
114
|
-
* Usage:
|
|
115
|
-
*
|
|
116
|
-
* ```javascript
|
|
117
|
-
* import { getCLS } from "mazey";
|
|
118
|
-
*
|
|
119
|
-
* getCLS().then(
|
|
120
|
-
* res => {
|
|
121
|
-
* console.log(`CLS: ${res}`);
|
|
122
|
-
* }
|
|
123
|
-
* );
|
|
124
|
-
* ```
|
|
125
|
-
*
|
|
126
|
-
* Output:
|
|
127
|
-
*
|
|
128
|
-
* ```text
|
|
129
|
-
* CLS: 123
|
|
130
|
-
* ```
|
|
131
|
-
*
|
|
132
|
-
* @returns A promise that resolves with the CLS score, or 0 if the "layout-shift" entry type is not supported.
|
|
133
|
-
* @category Perf
|
|
134
|
-
*/
|
|
135
|
-
export declare function getCLS(): Promise<number>;
|
|
136
|
-
/**
|
|
137
|
-
* Gets the time to first byte (TTFB) of a web page using the Performance API.
|
|
138
|
-
* The TTFB is the time it takes for the first byte of the response to be received by the browser.
|
|
139
|
-
*
|
|
140
|
-
* Usage:
|
|
141
|
-
*
|
|
142
|
-
* ```javascript
|
|
143
|
-
* import { getTTFB } from "mazey";
|
|
144
|
-
*
|
|
145
|
-
* getTTFB().then(
|
|
146
|
-
* res => {
|
|
147
|
-
* console.log(`TTFB: ${res}`);
|
|
148
|
-
* }
|
|
149
|
-
* );
|
|
150
|
-
* ```
|
|
151
|
-
*
|
|
152
|
-
* Output:
|
|
153
|
-
*
|
|
154
|
-
* ```text
|
|
155
|
-
* TTFB: 123
|
|
156
|
-
* ```
|
|
157
|
-
*
|
|
158
|
-
* @returns The TTFB in milliseconds, or 0 if the navigation timing information is not available.
|
|
159
|
-
* @category Perf
|
|
160
|
-
*/
|
|
161
|
-
export declare function getTTFB(): Promise<number>;
|
|
162
|
-
/**
|
|
163
|
-
* EN: Get page load time(`PerformanceNavigationTiming`).
|
|
164
|
-
*
|
|
165
|
-
* ZH: 获取页面加载相关的各项数据。
|
|
166
|
-
*
|
|
167
|
-
* @remarks
|
|
168
|
-
* This function uses the [`PerformanceNavigationTiming`](https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming) API to get page load time data.
|
|
169
|
-
* 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.
|
|
170
|
-
* 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/chengchuu/mazey/releases/tag/v3.9.7)).
|
|
171
|
-
*
|
|
172
|
-
* Usage:
|
|
173
|
-
*
|
|
174
|
-
* ```javascript
|
|
175
|
-
* import { getPerformance } from "mazey";
|
|
176
|
-
*
|
|
177
|
-
* // `camelCase:false` (Default) Return underline(`a_b`) data.
|
|
178
|
-
* // `camelCase:true` Return hump(`aB`) data.
|
|
179
|
-
* getPerformance()
|
|
180
|
-
* .then(res => {
|
|
181
|
-
* console.log(JSON.stringify(res));
|
|
182
|
-
* })
|
|
183
|
-
* .catch(console.error);
|
|
184
|
-
* ```
|
|
185
|
-
*
|
|
186
|
-
* Output:
|
|
187
|
-
*
|
|
188
|
-
* ```text
|
|
189
|
-
* {"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}
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* Results:
|
|
193
|
-
*
|
|
194
|
-
* | Attribute | Description | Type | Values |
|
|
195
|
-
* | :------------ | :------------ | :------------ | :------------ |
|
|
196
|
-
* | dns_time | DNS Lookup | number | domainLookupEnd - domainLookupStart |
|
|
197
|
-
* | tcp_time | Connection Negotiation | number | connectEnd - connectStart |
|
|
198
|
-
* | response_time | Requests and Responses | number | responseStart - requestStart |
|
|
199
|
-
* | white_time | White Screen | number | responseStart - navigationStart |
|
|
200
|
-
* | dom_ready_time | Dom Ready | number | domContentLoadedEventStart - navigationStart |
|
|
201
|
-
* | onload_time | Onload | number | loadEventStart - navigationStart |
|
|
202
|
-
* | render_time | EventEnd | number | loadEventEnd -navigationStart |
|
|
203
|
-
* | unload_time | Unload | number | (Optional) unloadEventEnd - unloadEventStart |
|
|
204
|
-
* | redirect_time | Redirect | number | (Optional) redirectEnd - redirectStart |
|
|
205
|
-
* | ssl_time | SSL | number | (Optional) connectEnd - secureConnectionStart |
|
|
206
|
-
* | download_time | Download | number | (Optional) responseEnd - responseStart |
|
|
207
|
-
*
|
|
208
|
-
* @param {boolean} camelCase -- false(默认) 以下划线形式返回数据 true 以驼峰形式返回数据
|
|
209
|
-
* @returns {Promise<object>} 加载数据
|
|
210
|
-
* @category Perf
|
|
211
|
-
*/
|
|
212
|
-
export declare function getPerformance(camelCase?: boolean): Promise<WebPerformance | Error>;
|
|
213
|
-
//# sourceMappingURL=perf.d.ts.map
|
package/lib/perf.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAe9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,CAe7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAe9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAoB9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAmB9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,OAAO,IAAI,OAAO,CAAC,MAAM,CAAC,CAc/C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAsB,cAAc,CAAC,SAAS,UAAQ,GAAG,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CA8QvF"}
|
package/lib/store.d.ts
DELETED
|
@@ -1,230 +0,0 @@
|
|
|
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
|
-
* import { setSessionStorage, getSessionStorage, setLocalStorage, getLocalStorage } from "mazey";
|
|
10
|
-
*
|
|
11
|
-
* setSessionStorage("test", "123");
|
|
12
|
-
* const ret1 = getSessionStorage("test");
|
|
13
|
-
* setLocalStorage("test", "123");
|
|
14
|
-
* const ret2 = getLocalStorage("test");
|
|
15
|
-
* console.log(ret1, ret2);
|
|
16
|
-
*
|
|
17
|
-
* // or package in usage
|
|
18
|
-
* const projectName = "mazey";
|
|
19
|
-
* function mSetLocalStorage (key, value) {
|
|
20
|
-
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
21
|
-
* }
|
|
22
|
-
*
|
|
23
|
-
* function mGetLocalStorage (key) {
|
|
24
|
-
* return getLocalStorage(`${projectName}_${key}`);
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*
|
|
28
|
-
* Output:
|
|
29
|
-
*
|
|
30
|
-
* ```text
|
|
31
|
-
* 123 123
|
|
32
|
-
* ```
|
|
33
|
-
*
|
|
34
|
-
* @param {string} key 键
|
|
35
|
-
* @returns {void} 返回值
|
|
36
|
-
* @category Store
|
|
37
|
-
*/
|
|
38
|
-
export declare function setSessionStorage<T>(key: string, value?: T | null): void;
|
|
39
|
-
/**
|
|
40
|
-
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
41
|
-
*
|
|
42
|
-
* ZH: 存储/获取数据到 sessionStorage/localStorage。
|
|
43
|
-
*
|
|
44
|
-
* Usage:
|
|
45
|
-
*
|
|
46
|
-
* ```javascript
|
|
47
|
-
* import { setSessionStorage, getSessionStorage, setLocalStorage, getLocalStorage } from "mazey";
|
|
48
|
-
*
|
|
49
|
-
* setSessionStorage("test", "123");
|
|
50
|
-
* const ret1 = getSessionStorage("test");
|
|
51
|
-
* setLocalStorage("test", "123");
|
|
52
|
-
* const ret2 = getLocalStorage("test");
|
|
53
|
-
* console.log(ret1, ret2);
|
|
54
|
-
*
|
|
55
|
-
* // or package in usage
|
|
56
|
-
* const projectName = "mazey";
|
|
57
|
-
* function mSetLocalStorage (key, value) {
|
|
58
|
-
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
59
|
-
* }
|
|
60
|
-
*
|
|
61
|
-
* function mGetLocalStorage (key) {
|
|
62
|
-
* return getLocalStorage(`${projectName}_${key}`);
|
|
63
|
-
* }
|
|
64
|
-
* ```
|
|
65
|
-
*
|
|
66
|
-
* Output:
|
|
67
|
-
*
|
|
68
|
-
* ```text
|
|
69
|
-
* 123 123
|
|
70
|
-
* ```
|
|
71
|
-
*
|
|
72
|
-
* @param {string} key 键
|
|
73
|
-
* @returns {any} 返回值
|
|
74
|
-
* @category Store
|
|
75
|
-
*/
|
|
76
|
-
export declare function getSessionStorage<T>(key: string): T | null;
|
|
77
|
-
/**
|
|
78
|
-
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
79
|
-
*
|
|
80
|
-
* ZH: 存储/获取数据到 sessionStorage/localStorage。
|
|
81
|
-
*
|
|
82
|
-
* Usage:
|
|
83
|
-
*
|
|
84
|
-
* ```javascript
|
|
85
|
-
* import { setSessionStorage, getSessionStorage, setLocalStorage, getLocalStorage } from "mazey";
|
|
86
|
-
*
|
|
87
|
-
* setSessionStorage("test", "123");
|
|
88
|
-
* const ret1 = getSessionStorage("test");
|
|
89
|
-
* setLocalStorage("test", "123");
|
|
90
|
-
* const ret2 = getLocalStorage("test");
|
|
91
|
-
* console.log(ret1, ret2);
|
|
92
|
-
*
|
|
93
|
-
* // or package in usage
|
|
94
|
-
* const projectName = "mazey";
|
|
95
|
-
* function mSetLocalStorage (key, value) {
|
|
96
|
-
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
97
|
-
* }
|
|
98
|
-
*
|
|
99
|
-
* function mGetLocalStorage (key) {
|
|
100
|
-
* return getLocalStorage(`${projectName}_${key}`);
|
|
101
|
-
* }
|
|
102
|
-
* ```
|
|
103
|
-
*
|
|
104
|
-
* Output:
|
|
105
|
-
*
|
|
106
|
-
* ```text
|
|
107
|
-
* 123 123
|
|
108
|
-
* ```
|
|
109
|
-
*
|
|
110
|
-
* @param {string} key 键
|
|
111
|
-
* @returns {void} 返回值
|
|
112
|
-
* @category Store
|
|
113
|
-
*/
|
|
114
|
-
export declare function setLocalStorage<T>(key: string, value?: T | null): void;
|
|
115
|
-
/**
|
|
116
|
-
* EN: Handle Storage (Keep fit for JSON, it can transfer format automatically).
|
|
117
|
-
*
|
|
118
|
-
* ZH: 存储/获取数据到 sessionStorage/localStorage。
|
|
119
|
-
*
|
|
120
|
-
* Usage:
|
|
121
|
-
*
|
|
122
|
-
* ```javascript
|
|
123
|
-
* import { setSessionStorage, getSessionStorage, setLocalStorage, getLocalStorage } from "mazey";
|
|
124
|
-
*
|
|
125
|
-
* setSessionStorage("test", "123");
|
|
126
|
-
* const ret1 = getSessionStorage("test");
|
|
127
|
-
* setLocalStorage("test", "123");
|
|
128
|
-
* const ret2 = getLocalStorage("test");
|
|
129
|
-
* console.log(ret1, ret2);
|
|
130
|
-
*
|
|
131
|
-
* // or package in usage
|
|
132
|
-
* const projectName = "mazey";
|
|
133
|
-
* function mSetLocalStorage (key, value) {
|
|
134
|
-
* return setLocalStorage(`${projectName}_${key}`, value);
|
|
135
|
-
* }
|
|
136
|
-
*
|
|
137
|
-
* function mGetLocalStorage (key) {
|
|
138
|
-
* return getLocalStorage(`${projectName}_${key}`);
|
|
139
|
-
* }
|
|
140
|
-
* ```
|
|
141
|
-
*
|
|
142
|
-
* Output:
|
|
143
|
-
*
|
|
144
|
-
* ```text
|
|
145
|
-
* 123 123
|
|
146
|
-
* ```
|
|
147
|
-
*
|
|
148
|
-
* @param {string} key 键
|
|
149
|
-
* @returns {void} 返回值
|
|
150
|
-
* @category Store
|
|
151
|
-
*/
|
|
152
|
-
export declare function getLocalStorage<T>(key: string): T | null;
|
|
153
|
-
/**
|
|
154
|
-
* EN: Handle Cookie.
|
|
155
|
-
*
|
|
156
|
-
* ZH: 设置/获取 Cookie。
|
|
157
|
-
*
|
|
158
|
-
* Usage:
|
|
159
|
-
*
|
|
160
|
-
* ```javascript
|
|
161
|
-
* import { setCookie, getCookie } from "mazey";
|
|
162
|
-
*
|
|
163
|
-
* setCookie("test", "123", 30, "example.com"); // key value day domain
|
|
164
|
-
* const ret = getCookie("test");
|
|
165
|
-
* console.log(ret);
|
|
166
|
-
* ```
|
|
167
|
-
*
|
|
168
|
-
* Output:
|
|
169
|
-
*
|
|
170
|
-
* ```text
|
|
171
|
-
* 123
|
|
172
|
-
* ```
|
|
173
|
-
*
|
|
174
|
-
* @category Store
|
|
175
|
-
*/
|
|
176
|
-
export declare function getCookie(name: string): string;
|
|
177
|
-
/**
|
|
178
|
-
* EN: Handle Cookie.
|
|
179
|
-
*
|
|
180
|
-
* ZH: 设置/获取 Cookie。
|
|
181
|
-
*
|
|
182
|
-
* Usage:
|
|
183
|
-
*
|
|
184
|
-
* ```javascript
|
|
185
|
-
* import { setCookie, getCookie } from "mazey";
|
|
186
|
-
*
|
|
187
|
-
* setCookie("test", "123", 30, "example.com"); // key value day domain
|
|
188
|
-
* const ret = getCookie("test");
|
|
189
|
-
* console.log(ret);
|
|
190
|
-
* ```
|
|
191
|
-
*
|
|
192
|
-
* Output:
|
|
193
|
-
*
|
|
194
|
-
* ```text
|
|
195
|
-
* 123
|
|
196
|
-
* ```
|
|
197
|
-
*
|
|
198
|
-
* @category Store
|
|
199
|
-
*/
|
|
200
|
-
export declare function setCookie(name: string, value: string, days?: number, domain?: string): void;
|
|
201
|
-
/**
|
|
202
|
-
* Delete a cookie by name.
|
|
203
|
-
*
|
|
204
|
-
* Usage:
|
|
205
|
-
*
|
|
206
|
-
* ```javascript
|
|
207
|
-
* import { removeCookie } from "mazey";
|
|
208
|
-
*
|
|
209
|
-
* const ret = removeCookie("test");
|
|
210
|
-
* console.log(ret);
|
|
211
|
-
* ```
|
|
212
|
-
*
|
|
213
|
-
* Output:
|
|
214
|
-
*
|
|
215
|
-
* ```text
|
|
216
|
-
* true
|
|
217
|
-
* ```
|
|
218
|
-
*
|
|
219
|
-
* @param name - The name of the cookie to delete.
|
|
220
|
-
* @returns `true` if the cookie was deleted successfully, `false` otherwise.
|
|
221
|
-
* @category Store
|
|
222
|
-
*/
|
|
223
|
-
export declare function removeCookie(name: string): boolean;
|
|
224
|
-
/**
|
|
225
|
-
* Alias of `removeCookie`.
|
|
226
|
-
*
|
|
227
|
-
* @hidden
|
|
228
|
-
*/
|
|
229
|
-
export declare function delCookie(name: string): void;
|
|
230
|
-
//# sourceMappingURL=store.d.ts.map
|
package/lib/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../src/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,CAAC,GAAG,IAAW,GAAG,IAAI,CAI9E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAS1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,GAAE,CAAC,GAAG,IAAW,GAAG,IAAI,CAI5E;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CASxD;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAW9C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;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;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAclD;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C"}
|