@clayui/shared
Advanced tools
Comparing version 3.65.0 to 3.67.0
@@ -9,3 +9,3 @@ /** | ||
*/ | ||
export declare const useMousePosition: () => MousePosition; | ||
export declare const useMousePosition: (delay?: number) => MousePosition; | ||
export {}; |
@@ -40,2 +40,4 @@ "use strict"; | ||
var useMousePosition = function useMousePosition() { | ||
var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 200; | ||
var _useState = (0, _react.useState)([0, 0]), | ||
@@ -49,3 +51,3 @@ _useState2 = _slicedToArray(_useState, 2), | ||
return setMousePosition([event.clientX, event.clientY]); | ||
}, 200); | ||
}, delay); | ||
window.addEventListener('mousemove', handleMousePosition); | ||
@@ -55,3 +57,3 @@ return function () { | ||
}; | ||
}, []); | ||
}, [delay]); | ||
return mousePosition; | ||
@@ -58,0 +60,0 @@ }; |
{ | ||
"name": "@clayui/shared", | ||
"version": "3.65.0", | ||
"version": "3.67.0", | ||
"description": "ClayShared component", | ||
@@ -44,3 +44,3 @@ "license": "BSD-3-Clause", | ||
], | ||
"gitHead": "603f05c8d617d98e29f0456b5d6618f9a95ce740" | ||
"gitHead": "71e84490088d72afb0240a7ef69cde23a6d5dd19" | ||
} |
@@ -28,3 +28,3 @@ /** | ||
*/ | ||
export const useMousePosition = () => { | ||
export const useMousePosition = (delay: number = 200) => { | ||
const [mousePosition, setMousePosition] = useState<MousePosition>([0, 0]); | ||
@@ -36,3 +36,3 @@ | ||
setMousePosition([event.clientX, event.clientY]), | ||
200 | ||
delay | ||
); | ||
@@ -44,5 +44,5 @@ | ||
window.removeEventListener('mousemove', handleMousePosition); | ||
}, []); | ||
}, [delay]); | ||
return mousePosition; | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
89979
2952
2428