@clayui/shared
Advanced tools
Comparing version 3.101.0 to 3.103.1
@@ -30,4 +30,5 @@ /** | ||
export { isMac, isIPhone, isIPad, isIOS, isAppleDevice } from './platform'; | ||
export { throttle } from './throttle'; | ||
export type { AlignPoints } from './useOverlayPositon'; | ||
export type { IBaseProps as IPortalBaseProps } from './Portal'; | ||
export type { InternalDispatch } from './useControlledState'; |
@@ -127,2 +127,8 @@ "use strict"; | ||
}); | ||
Object.defineProperty(exports, "throttle", { | ||
enumerable: true, | ||
get: function get() { | ||
return _throttle.throttle; | ||
} | ||
}); | ||
Object.defineProperty(exports, "useControlledState", { | ||
@@ -249,2 +255,4 @@ enumerable: true, | ||
var _throttle = require("./throttle"); | ||
/** | ||
@@ -251,0 +259,0 @@ * SPDX-FileCopyrightText: © 2019 Liferay, Inc. <https://liferay.com> |
@@ -10,2 +10,4 @@ "use strict"; | ||
var _throttle = require("./throttle"); | ||
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } | ||
@@ -23,19 +25,5 @@ | ||
function throttle(callback, limit) { | ||
var waiting = false; | ||
return function () { | ||
if (!waiting) { | ||
callback.apply(void 0, arguments); | ||
waiting = true; | ||
setTimeout(function () { | ||
waiting = false; | ||
}, limit); | ||
} | ||
}; | ||
} | ||
/** | ||
* Hook to get the current mouse position | ||
*/ | ||
var useMousePosition = function useMousePosition() { | ||
@@ -50,3 +38,3 @@ var delay = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 200; | ||
(0, _react.useEffect)(function () { | ||
var handleMousePosition = throttle(function (event) { | ||
var handleMousePosition = (0, _throttle.throttle)(function (event) { | ||
return setMousePosition([event.clientX, event.clientY]); | ||
@@ -53,0 +41,0 @@ }, delay); |
{ | ||
"name": "@clayui/shared", | ||
"version": "3.101.0", | ||
"version": "3.103.1", | ||
"description": "ClayShared component", | ||
@@ -45,3 +45,3 @@ "license": "BSD-3-Clause", | ||
], | ||
"gitHead": "55f8b720047b2aa4764d5de1302f715db62ed902" | ||
"gitHead": "cd95e9b9561858fb6832a524a2a0b0304a500d3f" | ||
} |
@@ -8,19 +8,6 @@ /** | ||
import {throttle} from './throttle'; | ||
type MousePosition = [number, number]; | ||
function throttle<T>(callback: Function, limit: number) { | ||
var waiting = false; | ||
return (...args: Array<T>) => { | ||
if (!waiting) { | ||
callback(...args); | ||
waiting = true; | ||
setTimeout(() => { | ||
waiting = false; | ||
}, limit); | ||
} | ||
}; | ||
} | ||
/** | ||
@@ -27,0 +14,0 @@ * Hook to get the current mouse position |
Sorry, the diff of this file is not supported yet
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
180312
86
5073