@os-design/use-throttle
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -7,6 +7,5 @@ "use strict"; | ||
exports["default"] = void 0; | ||
var _react = require("react"); | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
var useThrottle = function useThrottle(callback, ms) { | ||
@@ -23,4 +22,5 @@ var callbackRef = (0, _react.useRef)(); | ||
intervalRef.current = undefined; | ||
}, []); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
var call = (0, _react.useCallback)(function () { | ||
@@ -30,5 +30,3 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
} | ||
if (!callbackRef.current) return; | ||
if (intervalRef.current) { | ||
@@ -38,3 +36,2 @@ hasTrailingCallRef.current = true; | ||
} | ||
intervalRef.current = setInterval(function () { | ||
@@ -45,3 +42,2 @@ if (!hasTrailingCallRef.current) { | ||
} | ||
hasTrailingCallRef.current = false; | ||
@@ -55,5 +51,4 @@ if (!callbackRef.current) return; | ||
}; | ||
var _default = useThrottle; | ||
exports["default"] = _default; | ||
//# sourceMappingURL=index.js.map |
import { useCallback, useEffect, useRef } from 'react'; | ||
/* eslint-disable @typescript-eslint/no-explicit-any */ | ||
@@ -15,7 +16,7 @@ | ||
intervalRef.current = undefined; | ||
}, []); // eslint-disable-next-line react-hooks/exhaustive-deps | ||
}, []); | ||
// eslint-disable-next-line react-hooks/exhaustive-deps | ||
const call = useCallback((...args) => { | ||
if (!callbackRef.current) return; | ||
if (intervalRef.current) { | ||
@@ -25,3 +26,2 @@ hasTrailingCallRef.current = true; | ||
} | ||
intervalRef.current = setInterval(() => { | ||
@@ -32,3 +32,2 @@ if (!hasTrailingCallRef.current) { | ||
} | ||
hasTrailingCallRef.current = false; | ||
@@ -42,4 +41,3 @@ if (!callbackRef.current) return; | ||
}; | ||
export default useThrottle; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@os-design/use-throttle", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"license": "UNLICENSED", | ||
@@ -34,3 +34,3 @@ "repository": "git@gitlab.com:os-team/libs/os-design.git", | ||
}, | ||
"gitHead": "8d32820f40f43f64be2bf85f60973d358be83c1d" | ||
"gitHead": "8cb28f6719d699c014fbce91d832a9ff06abe515" | ||
} |
Sorry, the diff of this file is not supported yet
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
81
10303