@jiaozhiye/qm-design-react 1.9.14 → 1.9.16
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/lib/_utils/isMobile.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
declare const _default: () => boolean;
|
|
2
|
+
export default _default;
|
package/lib/hooks/useEvent.d.ts
CHANGED
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
import type { AnyFunction } from '../_utils/types';
|
|
2
|
+
/**
|
|
3
|
+
* 返回一个稳定的回调函数引用,并且函数内部拿到说有的变量都是最新的(没有React闭包特性的问题),
|
|
4
|
+
* 和 React.useCallback(() => {}, []) 有本质区别,弥补了其闭包的缺陷
|
|
5
|
+
* const resizeHandler = useEvent(() => {
|
|
6
|
+
* // ...
|
|
7
|
+
* });
|
|
8
|
+
* React.useEffect(() => {
|
|
9
|
+
* window.addEventListener('resize', resizeHandler);
|
|
10
|
+
* return () => window.removeEventListener('resize', resizeHandler);
|
|
11
|
+
* }, []);
|
|
12
|
+
*/
|
|
2
13
|
export default function useEvent<T extends AnyFunction<any>>(callback: T): T;
|