Skip to content

Commit f005932

Browse files
committed
fix: 🐛 Fixed husky issues
1 parent 6f71cda commit f005932

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ import { useThrottleState } from "@better-hooks/performance";
208208

209209
const MyComponent: React.FC = () => {
210210
const [value, setValue] = useThrottleState("20px", {
211-
executionInterval: 200, // We will save values at least once per 200ms
212-
executionTimeout: 400 // Last set state action will get triggered after 400ms, we can also disable it
211+
interval: 200, // We will save values at least once per 200ms
212+
timeout: 400 // Last set state action will get triggered after 400ms, we can also disable it
213213
})
214214

215215
useWindowEvent("scroll", (e) => {
@@ -237,7 +237,7 @@ const MyComponent: React.FC = (props) => {
237237

238238
useThrottleEffect(() => {
239239
// Do something
240-
}, { executionInterval: 200, executionTimeout: false }, [props])
240+
}, { interval: 200, timeout: false }, [props])
241241

242242
return (
243243
// ...

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
},
2525
"scripts": {
2626
"build": "rollup -c",
27-
"postinstall": "yarn husky install",
28-
"prepare": "install-peers",
27+
"prepare": "install-peers && yarn husky install",
2928
"lint": "eslint . --ext .js,.jsx,.tsx,.ts --fix",
3029
"test": "jest",
3130
"release": "yarn semantic-release"

src/hooks/use-throttle/use-throttle.hook.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import {
99
import { useForceUpdate } from "hooks/use-force-update";
1010

1111
export const useThrottle = (props?: UseThrottleProps): UseThrottleReturnType => {
12-
const { executionInterval = 200, executionTimeout = 200 } = props || {};
12+
const { interval = 200, timeout = 200 } = props || {};
1313
const lastExecution = useRef<number>(0);
1414
const newRun = useRef<boolean>(true);
1515
const shouldRerenderActive = useRef(false);
@@ -33,8 +33,8 @@ export const useThrottle = (props?: UseThrottleProps): UseThrottleReturnType =>
3333
rerenderActive();
3434
};
3535

36-
const intervalTime = dynamicProps?.executionInterval ?? executionInterval;
37-
const timeoutTime = dynamicProps?.executionTimeout ?? executionTimeout;
36+
const intervalTime = dynamicProps?.interval ?? interval;
37+
const timeoutTime = dynamicProps?.timeout ?? timeout;
3838
const shouldCallImmediately = Date.now() >= lastExecution.current + intervalTime;
3939

4040
if (newRun.current) rerenderActive();

src/hooks/use-throttle/use-throttle.types.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ export type UseThrottleProps = {
1515
/**
1616
* Execution interval time for triggering callback
1717
*/
18-
executionInterval?: number;
18+
interval?: number;
1919
/**
2020
* Callback timeout when throttling stops triggering
2121
*/
22-
executionTimeout?: number | false;
22+
timeout?: number | false;
2323
};

0 commit comments

Comments
 (0)