mazey 3.5.4 → 3.6.1
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 +217 -178
- package/lib/index.cjs.js +3666 -2775
- package/lib/index.d.ts +308 -43
- package/lib/index.d.ts.map +1 -1
- package/lib/index.esm.js +3660 -2776
- package/lib/mazey.min.js +2 -2
- package/package.json +1 -1
- package/scripts/env.sh +2 -0
- package/README_CN.md +0 -359
- package/examples/index.html +0 -21
- package/examples/index.ts +0 -121
- package/images/mazey-v1.4.39.svg +0 -1
- package/src/index.ts +0 -2260
- package/src/preview.js +0 -47
package/README.md
CHANGED
|
@@ -63,20 +63,16 @@ There ara some examples maintained by hand below. For more information, please c
|
|
|
63
63
|
* [windowLoaded](#windowloaded)
|
|
64
64
|
- [Util](#util)
|
|
65
65
|
* [isNumber](#isnumber)
|
|
66
|
-
* [generateRndNum](#generaterndnum)
|
|
67
66
|
* [isJsonString](#isjsonstring)
|
|
67
|
+
* [isValidData](#isvaliddata)
|
|
68
|
+
* [generateRndNum](#generaterndnum)
|
|
68
69
|
* [formatDate](#formatdate)
|
|
69
70
|
* [debounce](#debounce)
|
|
70
71
|
* [throttle](#throttle)
|
|
71
72
|
* [camelCaseToKebabCase](#camelcasetokebabcase)
|
|
72
73
|
* [camelCase2Underscore](#camelcase2underscore)
|
|
73
|
-
* [mTrim](#mtrim)
|
|
74
74
|
* [deepCopyObject](#deepcopyobject)
|
|
75
|
-
* [
|
|
76
|
-
- [DOM](#dom)
|
|
77
|
-
* [addStyle](#addstyle)
|
|
78
|
-
* [newLine](#newline)
|
|
79
|
-
* [Class](#class)
|
|
75
|
+
* [mTrim](#mtrim)
|
|
80
76
|
- [URL](#url)
|
|
81
77
|
* [getQueryParam](#getqueryparam)
|
|
82
78
|
* [getUrlParam](#geturlparam)
|
|
@@ -84,18 +80,21 @@ There ara some examples maintained by hand below. For more information, please c
|
|
|
84
80
|
* [getDomain](#getdomain)
|
|
85
81
|
* [updateQueryParam](#updatequeryparam)
|
|
86
82
|
- [Cache Data](#cache-data)
|
|
87
|
-
* [Storage](#storage)
|
|
88
83
|
* [Cookie](#cookie)
|
|
84
|
+
* [Storage](#storage)
|
|
85
|
+
- [DOM](#dom)
|
|
86
|
+
* [addStyle](#addstyle)
|
|
87
|
+
* [Class](#class)
|
|
88
|
+
* [newLine](#newline)
|
|
89
89
|
- [Calculate and Formula](#calculate-and-formula)
|
|
90
90
|
* [inRate](#inrate)
|
|
91
91
|
* [calLongestCommonSubstring](#callongestcommonsubstring)
|
|
92
92
|
* [calLongestCommonSubsequence](#callongestcommonsubsequence)
|
|
93
93
|
- [Browser Information](#browser-information)
|
|
94
94
|
* [getBrowserInfo](#getbrowserinfo)
|
|
95
|
+
* [isSafePWAEnv](#issafepwaenv)
|
|
95
96
|
- [Web Performance](#web-performance)
|
|
96
97
|
* [getPerformance](#getperformance)
|
|
97
|
-
- [Margin of Safety](#margin-of-safety)
|
|
98
|
-
* [isSafePWAEnv](#issafepwaenv)
|
|
99
98
|
- [Debug](#debug)
|
|
100
99
|
* [genCustomConsole](#gencustomconsole)
|
|
101
100
|
<!-- toc - end -->
|
|
@@ -208,16 +207,8 @@ isNumber(NaN, { isNaNAsNumber: true, isUnFiniteAsNumber: true }); // true
|
|
|
208
207
|
<!-- @param {*} num 被判断的值
|
|
209
208
|
@param {boolean} options.isNaNAsNumber 是否 NaN 算数字(默认不算)
|
|
210
209
|
@param {boolean} options.isUnFiniteAsNumber 是否 无限 算数字(默认不算)
|
|
211
|
-
@returns {boolean} true 是数字
|
|
212
|
-
|
|
213
|
-
#### generateRndNum
|
|
214
|
-
|
|
215
|
-
Produce a random string of number, `generateRndNum(7)` => '7658495'.
|
|
216
|
-
|
|
217
|
-
```
|
|
218
|
-
generateRndNum(4); // '9730'
|
|
219
|
-
generateRndNum(7); // '2262490'
|
|
220
|
-
```
|
|
210
|
+
@returns {boolean} true 是数字
|
|
211
|
+
@category Util -->
|
|
221
212
|
|
|
222
213
|
#### isJsonString
|
|
223
214
|
|
|
@@ -238,7 +229,59 @@ true
|
|
|
238
229
|
```
|
|
239
230
|
|
|
240
231
|
<!-- @param {string} str The string to check.
|
|
241
|
-
@returns {boolean} Return the result of checking.
|
|
232
|
+
@returns {boolean} Return the result of checking.
|
|
233
|
+
@category Util -->
|
|
234
|
+
|
|
235
|
+
#### isValidData
|
|
236
|
+
|
|
237
|
+
Determine the validity of the data.
|
|
238
|
+
|
|
239
|
+
Usage:
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
const validData = {
|
|
243
|
+
a: {
|
|
244
|
+
b: {
|
|
245
|
+
c: 413
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
};
|
|
249
|
+
|
|
250
|
+
const isValidDataResA = isValidData(validData, ['a', 'b', 'c'], 2333);
|
|
251
|
+
const isValidDataResB = isValidData(validData, ['a', 'b', 'c'], 413);
|
|
252
|
+
const isValidDataResC = isValidData(validData, ['d', 'd'], 413);
|
|
253
|
+
|
|
254
|
+
console.log('isValidDataResA:', isValidDataResA);
|
|
255
|
+
console.log('isValidDataResB:', isValidDataResB);
|
|
256
|
+
console.log('isValidDataResC:', isValidDataResC);
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Output:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
isValidDataResA: false
|
|
263
|
+
isValidDataResB: true
|
|
264
|
+
isValidDataResC: false
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
<!-- @param {any} data Original Data
|
|
268
|
+
@param {string[]} attributes Data Attributes
|
|
269
|
+
@param {any} validValue Given Value for verifying.
|
|
270
|
+
@returns {boolean} Return TRUE if the data is valid.
|
|
271
|
+
@category Util -->
|
|
272
|
+
|
|
273
|
+
#### generateRndNum
|
|
274
|
+
|
|
275
|
+
Produce a random string of number, `generateRndNum(7)` => '7658495'.
|
|
276
|
+
|
|
277
|
+
```
|
|
278
|
+
generateRndNum(4); // '9730'
|
|
279
|
+
generateRndNum(7); // '2262490'
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
<!-- @param {number} n Length
|
|
283
|
+
@returns {string} Return the random string.
|
|
284
|
+
@category Util -->
|
|
242
285
|
|
|
243
286
|
#### formatDate
|
|
244
287
|
|
|
@@ -264,7 +307,8 @@ Date formatDate value: 02/11/2014
|
|
|
264
307
|
|
|
265
308
|
<!-- @param {Date|number|string} dateIns Original Date
|
|
266
309
|
@param {string} format Format String
|
|
267
|
-
@returns {string} Return the formatted date string.
|
|
310
|
+
@returns {string} Return the formatted date string.
|
|
311
|
+
@category Util -->
|
|
268
312
|
|
|
269
313
|
#### debounce
|
|
270
314
|
|
|
@@ -278,6 +322,8 @@ const foo = debounce(() => {
|
|
|
278
322
|
}, 1000, true);
|
|
279
323
|
```
|
|
280
324
|
|
|
325
|
+
<!-- @category Util -->
|
|
326
|
+
|
|
281
327
|
#### throttle
|
|
282
328
|
|
|
283
329
|
Throttle
|
|
@@ -292,6 +338,8 @@ const foo = throttle(() => {
|
|
|
292
338
|
|
|
293
339
|
Reference: [Lodash](https://lodash.com/docs/4.17.15#throttle)
|
|
294
340
|
|
|
341
|
+
<!-- @category Util -->
|
|
342
|
+
|
|
295
343
|
#### camelCaseToKebabCase
|
|
296
344
|
|
|
297
345
|
Transfer CamelCase to KebabCase.
|
|
@@ -302,7 +350,8 @@ camelCaseToKebabCase('aBC'); // a-b-c
|
|
|
302
350
|
```
|
|
303
351
|
|
|
304
352
|
<!-- @param {string} camelCase 'aBC' or 'ABC'
|
|
305
|
-
@returns {string} 'a-b-c'
|
|
353
|
+
@returns {string} 'a-b-c'
|
|
354
|
+
@category Util -->
|
|
306
355
|
|
|
307
356
|
#### camelCase2Underscore
|
|
308
357
|
|
|
@@ -314,19 +363,8 @@ camelCase2Underscore('aBC'); // a_b_c
|
|
|
314
363
|
```
|
|
315
364
|
|
|
316
365
|
<!-- @param {string} camelCase 'aBC' or 'ABC'
|
|
317
|
-
@returns {string} 'a_b_c'
|
|
318
|
-
|
|
319
|
-
#### mTrim
|
|
320
|
-
|
|
321
|
-
Remove leading and trailing whitespace or specified characters from string.
|
|
322
|
-
|
|
323
|
-
```
|
|
324
|
-
mTrim(' 1 2 3 '); // '1 2 3'
|
|
325
|
-
mTrim('abc '); // 'abc'
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
<!-- @param {string} str The string to trim.
|
|
329
|
-
@returns {string} Trimmed string. -->
|
|
366
|
+
@returns {string} 'a_b_c'
|
|
367
|
+
@category Util -->
|
|
330
368
|
|
|
331
369
|
#### deepCopyObject
|
|
332
370
|
|
|
@@ -347,111 +385,21 @@ Output:
|
|
|
347
385
|
```
|
|
348
386
|
|
|
349
387
|
<!-- @param {object} obj The value to clone.
|
|
350
|
-
@returns {object} Returns the deep cloned value.
|
|
351
|
-
|
|
352
|
-
#### isValidData
|
|
353
|
-
|
|
354
|
-
Determine the validity of the data.
|
|
355
|
-
|
|
356
|
-
Usage:
|
|
388
|
+
@returns {object} Returns the deep cloned value.
|
|
389
|
+
@category Util -->
|
|
357
390
|
|
|
358
|
-
|
|
359
|
-
const validData = {
|
|
360
|
-
a: {
|
|
361
|
-
b: {
|
|
362
|
-
c: 413
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
};
|
|
366
|
-
|
|
367
|
-
const isValidDataResA = isValidData(validData, ['a', 'b', 'c'], 2333);
|
|
368
|
-
const isValidDataResB = isValidData(validData, ['a', 'b', 'c'], 413);
|
|
369
|
-
const isValidDataResC = isValidData(validData, ['d', 'd'], 413);
|
|
370
|
-
|
|
371
|
-
console.log('isValidDataResA:', isValidDataResA);
|
|
372
|
-
console.log('isValidDataResB:', isValidDataResB);
|
|
373
|
-
console.log('isValidDataResC:', isValidDataResC);
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
Output:
|
|
377
|
-
|
|
378
|
-
```
|
|
379
|
-
isValidDataResA: false
|
|
380
|
-
isValidDataResB: true
|
|
381
|
-
isValidDataResC: false
|
|
382
|
-
```
|
|
383
|
-
|
|
384
|
-
<!-- @param {any} data Original Data
|
|
385
|
-
@param {string[]} attributes Data Attributes
|
|
386
|
-
@param {any} validValue Given Value for verifying.
|
|
387
|
-
@returns {boolean} Return TRUE if the data is valid. -->
|
|
388
|
-
|
|
389
|
-
### DOM
|
|
390
|
-
|
|
391
|
-
#### addStyle
|
|
392
|
-
|
|
393
|
-
Add `<style>` in `<head>`.
|
|
394
|
-
|
|
395
|
-
Case 1: Add the `<style>` with `id`, and repeated invoking will update the content instead of adding a new one.
|
|
396
|
-
|
|
397
|
-
```
|
|
398
|
-
addStyle(
|
|
399
|
-
`
|
|
400
|
-
body {
|
|
401
|
-
background-color: #333;
|
|
402
|
-
}
|
|
403
|
-
`,
|
|
404
|
-
{
|
|
405
|
-
id: 'test',
|
|
406
|
-
}
|
|
407
|
-
);
|
|
408
|
-
// <style id="test">
|
|
409
|
-
// body {
|
|
410
|
-
// background-color: #333;
|
|
411
|
-
// }
|
|
412
|
-
// </style>
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
Case 2: Add the `<style>` without `id`, and repeated invoking will adding a new one.
|
|
416
|
-
|
|
417
|
-
```
|
|
418
|
-
addStyle(
|
|
419
|
-
`
|
|
420
|
-
body {
|
|
421
|
-
background-color: #444;
|
|
422
|
-
}
|
|
423
|
-
`
|
|
424
|
-
);
|
|
425
|
-
// <style>
|
|
426
|
-
// body {
|
|
427
|
-
// background-color: #444;
|
|
428
|
-
// }
|
|
429
|
-
// </style>
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
#### newLine
|
|
391
|
+
#### mTrim
|
|
433
392
|
|
|
434
|
-
|
|
393
|
+
Remove leading and trailing whitespace or specified characters from string.
|
|
435
394
|
|
|
436
395
|
```
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
```
|
|
440
|
-
|
|
441
|
-
#### Class
|
|
442
|
-
|
|
443
|
-
Modify `class`.
|
|
444
|
-
|
|
396
|
+
mTrim(' 1 2 3 '); // '1 2 3'
|
|
397
|
+
mTrim('abc '); // 'abc'
|
|
445
398
|
```
|
|
446
|
-
const dom = document.querySelector('#box');
|
|
447
399
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
addClass(dom, 'test');
|
|
452
|
-
// Remove `class`
|
|
453
|
-
removeClass(dom, 'test');
|
|
454
|
-
```
|
|
400
|
+
<!-- @param {string} str The string to trim.
|
|
401
|
+
@returns {string} Trimmed string.
|
|
402
|
+
@category Util -->
|
|
455
403
|
|
|
456
404
|
### URL
|
|
457
405
|
|
|
@@ -556,10 +504,25 @@ http://example.com/?t1=1&t2=2&t3=3&t4=four
|
|
|
556
504
|
|
|
557
505
|
### Cache Data
|
|
558
506
|
|
|
507
|
+
#### Cookie
|
|
508
|
+
|
|
509
|
+
Handle Cookie.
|
|
510
|
+
|
|
511
|
+
<!-- ZH: 设置/获取 Cookie -->
|
|
512
|
+
|
|
513
|
+
```
|
|
514
|
+
setCookie('test', '123', 30, 'example.com'); // key value day domain
|
|
515
|
+
getCookie('test'); // 123
|
|
516
|
+
```
|
|
517
|
+
|
|
518
|
+
<!-- @category Cache Data -->
|
|
519
|
+
|
|
559
520
|
#### Storage
|
|
560
521
|
|
|
561
522
|
Handle Storage (Keep fit for JSON, it can tansfer format automatically).
|
|
562
523
|
|
|
524
|
+
<!-- ZH: 存储/获取数据到 sessionStorage/localStorage -->
|
|
525
|
+
|
|
563
526
|
```
|
|
564
527
|
setSessionStorage('test', '123');
|
|
565
528
|
getSessionStorage('test'); // 123
|
|
@@ -577,15 +540,87 @@ function mGetLocalStorage (key) {
|
|
|
577
540
|
}
|
|
578
541
|
```
|
|
579
542
|
|
|
580
|
-
|
|
543
|
+
<!-- @param {string} key 键
|
|
544
|
+
@returns {any} 返回值
|
|
545
|
+
@category Cache Data -->
|
|
581
546
|
|
|
582
|
-
|
|
547
|
+
### DOM
|
|
548
|
+
|
|
549
|
+
#### addStyle
|
|
550
|
+
|
|
551
|
+
Add `<style>` in `<head>`.
|
|
552
|
+
|
|
553
|
+
<!-- ZH: 添加样式标签; style: 样式标签内的字符串; id: `<style>` 标签的 `id`; 返回: 添加成功/失败 -->
|
|
554
|
+
|
|
555
|
+
Example 1: Add the `<style>` with `id`, and repeated invoking will update the content instead of adding a new one.
|
|
583
556
|
|
|
584
557
|
```
|
|
585
|
-
|
|
586
|
-
|
|
558
|
+
addStyle(
|
|
559
|
+
`
|
|
560
|
+
body {
|
|
561
|
+
background-color: #333;
|
|
562
|
+
}
|
|
563
|
+
`,
|
|
564
|
+
{
|
|
565
|
+
id: 'test',
|
|
566
|
+
}
|
|
567
|
+
);
|
|
568
|
+
// <style id="test">
|
|
569
|
+
// body {
|
|
570
|
+
// background-color: #333;
|
|
571
|
+
// }
|
|
572
|
+
// </style>
|
|
587
573
|
```
|
|
588
574
|
|
|
575
|
+
Example 2: Add the `<style>` without `id`, and repeated invoking will adding a new one.
|
|
576
|
+
|
|
577
|
+
```
|
|
578
|
+
addStyle(
|
|
579
|
+
`
|
|
580
|
+
body {
|
|
581
|
+
background-color: #444;
|
|
582
|
+
}
|
|
583
|
+
`
|
|
584
|
+
);
|
|
585
|
+
// <style>
|
|
586
|
+
// body {
|
|
587
|
+
// background-color: #444;
|
|
588
|
+
// }
|
|
589
|
+
// </style>
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
<!-- @category DOM -->
|
|
593
|
+
|
|
594
|
+
#### Class
|
|
595
|
+
|
|
596
|
+
Modify `class`.
|
|
597
|
+
|
|
598
|
+
```
|
|
599
|
+
const dom = document.querySelector('#box');
|
|
600
|
+
|
|
601
|
+
// Determine `class`
|
|
602
|
+
hasClass(dom, 'test');
|
|
603
|
+
// Add `class`
|
|
604
|
+
addClass(dom, 'test');
|
|
605
|
+
// Remove `class`
|
|
606
|
+
removeClass(dom, 'test');
|
|
607
|
+
```
|
|
608
|
+
|
|
609
|
+
<!-- @category DOM -->
|
|
610
|
+
|
|
611
|
+
#### newLine
|
|
612
|
+
|
|
613
|
+
Make a newline of HTML.
|
|
614
|
+
|
|
615
|
+
```
|
|
616
|
+
newLine('a\nb\nc'); // 'a<br />b<br />c'
|
|
617
|
+
newLine('a\n\nbc'); // 'a<br /><br />bc'
|
|
618
|
+
```
|
|
619
|
+
|
|
620
|
+
<!-- @param {string} str The string to make a newline.
|
|
621
|
+
@returns {string} A newline with `br`.
|
|
622
|
+
@category DOM -->
|
|
623
|
+
|
|
589
624
|
### Calculate and Formula
|
|
590
625
|
|
|
591
626
|
#### inRate
|
|
@@ -623,7 +658,8 @@ console.log(trueCount, falseCount); // 499994 500006
|
|
|
623
658
|
```
|
|
624
659
|
|
|
625
660
|
<!-- @param {number} rate -- 0.1 ~ 1 => 1% ~ 100%
|
|
626
|
-
@returns {boolean} true 命中
|
|
661
|
+
@returns {boolean} true 命中
|
|
662
|
+
@category Calculate and Formula -->
|
|
627
663
|
|
|
628
664
|
#### calLongestCommonSubstring
|
|
629
665
|
|
|
@@ -645,7 +681,8 @@ Output:
|
|
|
645
681
|
|
|
646
682
|
<!-- @param {string} aStr String
|
|
647
683
|
@param {string} bStr String
|
|
648
|
-
@returns {number} Length
|
|
684
|
+
@returns {number} Length
|
|
685
|
+
@category Calculate and Formula -->
|
|
649
686
|
|
|
650
687
|
#### calLongestCommonSubsequence
|
|
651
688
|
|
|
@@ -667,7 +704,8 @@ Output:
|
|
|
667
704
|
|
|
668
705
|
<!-- @param {string} aStr 字符串
|
|
669
706
|
@param {string} bStr 字符串
|
|
670
|
-
@returns {number} 长度
|
|
707
|
+
@returns {number} 长度
|
|
708
|
+
@category Calculate and Formula -->
|
|
671
709
|
|
|
672
710
|
### Browser Information
|
|
673
711
|
|
|
@@ -691,18 +729,18 @@ Output:
|
|
|
691
729
|
|
|
692
730
|
Results:
|
|
693
731
|
|
|
694
|
-
|
|
|
695
|
-
| --- | --- | --- |
|
|
696
|
-
| System |
|
|
697
|
-
| System version |
|
|
698
|
-
| Platform |
|
|
699
|
-
| Engine |
|
|
700
|
-
| Engine version |
|
|
701
|
-
| Supporter |
|
|
702
|
-
| Supporter version |
|
|
703
|
-
| Shell |
|
|
704
|
-
| Shell version |
|
|
705
|
-
| Apple device type |
|
|
732
|
+
| Attribute | Description | Type | Values |
|
|
733
|
+
| --- | --- | --- | --- |
|
|
734
|
+
| **system** | System | string | android, ios, windows, macos, linux |
|
|
735
|
+
| systemVs | System version | string | windows: 2000, xp, 2003, vista, 7, 8, 8.1, 10 <br />macos: ... |
|
|
736
|
+
| platform | Platform | string | desktop, mobile |
|
|
737
|
+
| engine | Engine | string | webkit, gecko, presto, trident |
|
|
738
|
+
| engineVs | Engine version | string | - |
|
|
739
|
+
| supporter | Supporter | string | edge, opera, chrome, safari, firefox, iexplore |
|
|
740
|
+
| supporterVs | Supporter version | string | - |
|
|
741
|
+
| shell | Shell | string | (Optional) wechat, qq_browser, qq_app, uc, 360, 2345, sougou, liebao, maxthon, bilibili |
|
|
742
|
+
| shellVs | Shell version | string | (Optional) 20/... |
|
|
743
|
+
| appleType | Apple device type | string | (Optional) ipad, iphone, ipod, iwatch |
|
|
706
744
|
|
|
707
745
|
Example: Determine the environment of the mobile QQ.
|
|
708
746
|
|
|
@@ -714,6 +752,27 @@ const isMobileQQ = ['android', 'ios'].includes(system) && ['qq_browser', 'qq_app
|
|
|
714
752
|
<!-- @returns 浏览器信息
|
|
715
753
|
@category Browser Information -->
|
|
716
754
|
|
|
755
|
+
#### isSafePWAEnv
|
|
756
|
+
|
|
757
|
+
Detect the margin of Safety. Determine if it is a secure PWA environment that it can run.
|
|
758
|
+
|
|
759
|
+
<!-- ZH: 判断是否是安全的 PWA 环境 -->
|
|
760
|
+
|
|
761
|
+
Usage:
|
|
762
|
+
|
|
763
|
+
```
|
|
764
|
+
isSafePWAEnv();
|
|
765
|
+
```
|
|
766
|
+
|
|
767
|
+
Output:
|
|
768
|
+
|
|
769
|
+
```
|
|
770
|
+
true
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
<!-- @returns {boolean} true 是
|
|
774
|
+
@category Browser Information -->
|
|
775
|
+
|
|
717
776
|
### Web Performance
|
|
718
777
|
|
|
719
778
|
#### getPerformance
|
|
@@ -757,29 +816,8 @@ Results:
|
|
|
757
816
|
| Download | download_time | (Optional) responseEnd - responseStart |
|
|
758
817
|
|
|
759
818
|
<!-- @param {boolean} camelCase -- false(默认) 以下划线形式返回数据 true 以驼峰形式返回数据
|
|
760
|
-
@returns {Promise<object>} 加载数据
|
|
761
|
-
|
|
762
|
-
### Margin of Safety
|
|
763
|
-
|
|
764
|
-
#### isSafePWAEnv
|
|
765
|
-
|
|
766
|
-
Determine if it is a secure PWA environment that it can run.
|
|
767
|
-
|
|
768
|
-
<!-- ZH: 判断是否是安全的 PWA 环境 -->
|
|
769
|
-
|
|
770
|
-
Usage:
|
|
771
|
-
|
|
772
|
-
```
|
|
773
|
-
isSafePWAEnv();
|
|
774
|
-
```
|
|
775
|
-
|
|
776
|
-
Output:
|
|
777
|
-
|
|
778
|
-
```
|
|
779
|
-
true
|
|
780
|
-
```
|
|
781
|
-
|
|
782
|
-
<!-- @returns {boolean} true 是 -->
|
|
819
|
+
@returns {Promise<object>} 加载数据
|
|
820
|
+
@category Web Performance -->
|
|
783
821
|
|
|
784
822
|
### Debug
|
|
785
823
|
|
|
@@ -812,7 +850,8 @@ MazeyLog: I am object. {a: 123, b: 456}
|
|
|
812
850
|
@param {string} locales A locale string.
|
|
813
851
|
@param {function} logFn The function with Log.
|
|
814
852
|
@param {function} errorFn The function with Error.
|
|
815
|
-
@returns {object} 新实例
|
|
853
|
+
@returns {object} 新实例
|
|
854
|
+
@category Debug -->
|
|
816
855
|
|
|
817
856
|
## Contributing
|
|
818
857
|
|