@@ -8,11 +8,7 @@ interface WindowSizeOptions {
}
export function useWindowSizeFn<T>(fn: Fn<T>, wait = 150, options?: WindowSizeOptions) {
- let handler = () => {
- fn()
- }
- const handleSize = useDebounceFn(handler, wait)
- handler = handleSize
+ const { run: handler } = useDebounceFn(fn, wait)
const start = () => {
if (options && options.immediate) {