parsec-hooks 1.0.18 → 1.0.19
Sign up to get free protection for your applications and to get access to all the features.
@@ -13,6 +13,8 @@ var _react = require("react");
|
|
13
13
|
|
14
14
|
var _refStateHooks = _interopRequireDefault(require("../refStateHooks"));
|
15
15
|
|
16
|
+
var _requestAnimationFramePolyfill = require("request-animation-frame-polyfill");
|
17
|
+
|
16
18
|
var stops = {};
|
17
19
|
|
18
20
|
var setTimeInterval = function setTimeInterval(fn, ms) {
|
@@ -28,17 +30,17 @@ var setTimeInterval = function setTimeInterval(fn, ms) {
|
|
28
30
|
|
29
31
|
if (now - prev > ms) {
|
30
32
|
fn();
|
31
|
-
requestAnimationFrame(function () {
|
33
|
+
(0, _requestAnimationFramePolyfill.requestAnimationFrame)(function () {
|
32
34
|
return start(now);
|
33
35
|
});
|
34
36
|
} else {
|
35
|
-
requestAnimationFrame(function () {
|
37
|
+
(0, _requestAnimationFramePolyfill.requestAnimationFrame)(function () {
|
36
38
|
return start(prev);
|
37
39
|
});
|
38
40
|
}
|
39
41
|
};
|
40
42
|
|
41
|
-
requestAnimationFrame(function () {
|
43
|
+
(0, _requestAnimationFramePolyfill.requestAnimationFrame)(function () {
|
42
44
|
return start(startTime);
|
43
45
|
});
|
44
46
|
return id;
|
@@ -70,6 +70,7 @@ function _default(getListFn, _ref) {
|
|
70
70
|
var preVisible = (0, _previousHooks.default)(loadMoreVisible);
|
71
71
|
|
72
72
|
var _usePromise = (0, _promiseHooks.default)((0, _react.useCallback)(function (retainList) {
|
73
|
+
console.log(2222, dataRef.current);
|
73
74
|
var _dataRef$current = dataRef.current,
|
74
75
|
page = _dataRef$current.page,
|
75
76
|
limit = _dataRef$current.limit,
|
@@ -88,6 +89,14 @@ function _default(getListFn, _ref) {
|
|
88
89
|
if (count === countRef.current) {
|
89
90
|
var list = pageNum === defaultPage || retainList ? newList : [].concat((0, _toConsumableArray2.default)(resList), (0, _toConsumableArray2.default)(newList));
|
90
91
|
setIsEnd(list.length >= total);
|
92
|
+
console.log(1111, {
|
93
|
+
'list.length': list.length,
|
94
|
+
defaultLimit: defaultLimit
|
95
|
+
}, {
|
96
|
+
page: Math.ceil(list.length < defaultLimit ? 1 : list.length / defaultLimit + 1),
|
97
|
+
limit: defaultLimit,
|
98
|
+
list: list
|
99
|
+
});
|
91
100
|
setData({
|
92
101
|
page: Math.ceil(list.length < defaultLimit ? 1 : list.length / defaultLimit + 1),
|
93
102
|
limit: defaultLimit,
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "parsec-hooks",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.19",
|
4
4
|
"description": "秒差距前端常用的hooks工具",
|
5
5
|
"author": "mushan0x0",
|
6
6
|
"license": "MIT",
|
@@ -39,6 +39,7 @@
|
|
39
39
|
"import-cdn-js": "^0.0.2",
|
40
40
|
"intersection-observer": "^0.8.0",
|
41
41
|
"qs": "^6.9.4",
|
42
|
+
"request-animation-frame-polyfill": "^1.1.2",
|
42
43
|
"resize-observer-polyfill": "^1.5.1",
|
43
44
|
"unstated-next": "^1.1.0"
|
44
45
|
},
|