@hairy/react-lib 1.20.0 → 1.21.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/dist/index.cjs +5 -8
- package/dist/index.global.js +5 -8
- package/dist/index.js +5 -8
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -437,24 +437,21 @@ function track(action, status) {
|
|
|
437
437
|
let loadings = 0;
|
|
438
438
|
const tracking = () => loadings++ === 0 && (status.loading = true);
|
|
439
439
|
const done = () => !--loadings && (status.loading = false);
|
|
440
|
-
const fulfilled = () => {
|
|
440
|
+
const fulfilled = (value) => {
|
|
441
441
|
status.finished = true;
|
|
442
442
|
done();
|
|
443
|
+
return value;
|
|
443
444
|
};
|
|
444
445
|
const rejected = (error) => {
|
|
445
446
|
status.error = error;
|
|
446
447
|
done();
|
|
448
|
+
throw error;
|
|
447
449
|
};
|
|
448
450
|
return function(...args) {
|
|
449
451
|
tracking();
|
|
450
452
|
try {
|
|
451
|
-
const
|
|
452
|
-
|
|
453
|
-
return result.then(fulfilled).catch(rejected);
|
|
454
|
-
} else {
|
|
455
|
-
fulfilled();
|
|
456
|
-
return result;
|
|
457
|
-
}
|
|
453
|
+
const value = action(...args);
|
|
454
|
+
return value instanceof Promise ? value.then(fulfilled, rejected) : fulfilled(value);
|
|
458
455
|
} catch (error) {
|
|
459
456
|
rejected(error);
|
|
460
457
|
}
|
package/dist/index.global.js
CHANGED
|
@@ -1115,24 +1115,21 @@ var LibReact = (() => {
|
|
|
1115
1115
|
let loadings = 0;
|
|
1116
1116
|
const tracking = () => loadings++ === 0 && (status.loading = true);
|
|
1117
1117
|
const done = () => !--loadings && (status.loading = false);
|
|
1118
|
-
const fulfilled = () => {
|
|
1118
|
+
const fulfilled = (value) => {
|
|
1119
1119
|
status.finished = true;
|
|
1120
1120
|
done();
|
|
1121
|
+
return value;
|
|
1121
1122
|
};
|
|
1122
1123
|
const rejected = (error) => {
|
|
1123
1124
|
status.error = error;
|
|
1124
1125
|
done();
|
|
1126
|
+
throw error;
|
|
1125
1127
|
};
|
|
1126
1128
|
return function(...args) {
|
|
1127
1129
|
tracking();
|
|
1128
1130
|
try {
|
|
1129
|
-
const
|
|
1130
|
-
|
|
1131
|
-
return result.then(fulfilled).catch(rejected);
|
|
1132
|
-
} else {
|
|
1133
|
-
fulfilled();
|
|
1134
|
-
return result;
|
|
1135
|
-
}
|
|
1131
|
+
const value = action(...args);
|
|
1132
|
+
return value instanceof Promise ? value.then(fulfilled, rejected) : fulfilled(value);
|
|
1136
1133
|
} catch (error) {
|
|
1137
1134
|
rejected(error);
|
|
1138
1135
|
}
|
package/dist/index.js
CHANGED
|
@@ -377,24 +377,21 @@ function track(action, status) {
|
|
|
377
377
|
let loadings = 0;
|
|
378
378
|
const tracking = () => loadings++ === 0 && (status.loading = true);
|
|
379
379
|
const done = () => !--loadings && (status.loading = false);
|
|
380
|
-
const fulfilled = () => {
|
|
380
|
+
const fulfilled = (value) => {
|
|
381
381
|
status.finished = true;
|
|
382
382
|
done();
|
|
383
|
+
return value;
|
|
383
384
|
};
|
|
384
385
|
const rejected = (error) => {
|
|
385
386
|
status.error = error;
|
|
386
387
|
done();
|
|
388
|
+
throw error;
|
|
387
389
|
};
|
|
388
390
|
return function(...args) {
|
|
389
391
|
tracking();
|
|
390
392
|
try {
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
return result.then(fulfilled).catch(rejected);
|
|
394
|
-
} else {
|
|
395
|
-
fulfilled();
|
|
396
|
-
return result;
|
|
397
|
-
}
|
|
393
|
+
const value = action(...args);
|
|
394
|
+
return value instanceof Promise ? value.then(fulfilled, rejected) : fulfilled(value);
|
|
398
395
|
} catch (error) {
|
|
399
396
|
rejected(error);
|
|
400
397
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hairy/react-lib",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.21.0",
|
|
5
5
|
"description": "Library for react",
|
|
6
6
|
"author": "Hairyf <wwu710632@gmail.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"react-dom": "^18.2.0",
|
|
39
39
|
"react-i18next": "^14.1.2",
|
|
40
40
|
"react-use": "^17.6.0",
|
|
41
|
-
"@hairy/utils": "1.
|
|
41
|
+
"@hairy/utils": "1.21.0"
|
|
42
42
|
},
|
|
43
43
|
"scripts": {
|
|
44
44
|
"build": "tsup",
|