xxf_react 0.4.8 → 0.4.9
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promise_ext.d.ts","sourceRoot":"","sources":["../../src/flow/promise_ext.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,OAAO,CAAC,CAAC;QACf,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;KACjE;CACJ;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAgDhD"}
|
|
1
|
+
{"version":3,"file":"promise_ext.d.ts","sourceRoot":"","sources":["../../src/flow/promise_ext.ts"],"names":[],"mappings":"AAIA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,OAAO,CAAC,CAAC;QACf,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;KACjE;CACJ;AAGD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM1D;AAED,wBAAgB,yBAAyB,IAAI,IAAI,CAgDhD"}
|
package/dist/flow/promise_ext.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// src/lib/promise_ext.ts
|
|
2
2
|
import { toast } from "react-toastify";
|
|
3
|
+
// 或者更完整的判断
|
|
4
|
+
export function isSafariLoadFailed(error) {
|
|
5
|
+
return (error instanceof TypeError &&
|
|
6
|
+
(error.message === 'Load failed' ||
|
|
7
|
+
error.message.includes('Load failed')));
|
|
8
|
+
}
|
|
3
9
|
export function initPromiseErrorExtension() {
|
|
4
10
|
if (typeof Promise === 'undefined') {
|
|
5
11
|
console.warn('Promise is not available in this environment.');
|
|
@@ -14,7 +20,7 @@ export function initPromiseErrorExtension() {
|
|
|
14
20
|
Object.defineProperty(Promise.prototype, 'bindErrorNotice', {
|
|
15
21
|
value: function (filter) {
|
|
16
22
|
return this.catch((error) => {
|
|
17
|
-
const shouldHandle = filter ? filter(error) :
|
|
23
|
+
const shouldHandle = filter ? filter(error) : !isSafariLoadFailed(error);
|
|
18
24
|
if (shouldHandle) {
|
|
19
25
|
// 错误处理逻辑
|
|
20
26
|
console.error('==========>[Promise Error Notice]', {
|