Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ahooks

Package Overview
Dependencies
Maintainers
5
Versions
111
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ahooks - npm Package Compare versions

Comparing version 2.7.0 to 2.7.1

3

es/useDebounceFn/index.d.ts

@@ -1,6 +0,5 @@

/// <reference types="lodash" />
import { DebounceOptions } from '../useDebounce/debounceOptions';
declare type Fn = (...args: any) => any;
declare function useDebounceFn<T extends Fn>(fn: T, options?: DebounceOptions): {
run: T & import("lodash").Cancelable;
run: T;
cancel: () => void;

@@ -7,0 +6,0 @@ flush: () => void;

@@ -5,4 +5,4 @@ import { useEffect, useRef } from 'react';

var immediate = options === null || options === void 0 ? void 0 : options.immediate;
var timerRef = useRef();
timerRef.current = fn;
var fnRef = useRef();
fnRef.current = fn;
useEffect(function () {

@@ -14,3 +14,3 @@ var _a;

if (immediate) {
(_a = timerRef.current) === null || _a === void 0 ? void 0 : _a.call(timerRef);
(_a = fnRef.current) === null || _a === void 0 ? void 0 : _a.call(fnRef);
}

@@ -21,3 +21,3 @@

(_a = timerRef.current) === null || _a === void 0 ? void 0 : _a.call(timerRef);
(_a = fnRef.current) === null || _a === void 0 ? void 0 : _a.call(fnRef);
}, delay);

@@ -24,0 +24,0 @@ return function () {

@@ -18,3 +18,4 @@ var __values = this && this.__values || function (o) {

import { useEffect, useCallback, useRef } from 'react';
import { useEffect, useRef } from 'react';
import usePersistFn from '../usePersistFn';
import { getTargetElement } from '../utils/dom'; // 键盘事件 keyCode 别名

@@ -180,3 +181,3 @@

callbackRef.current = eventHandler;
var callbackHandler = useCallback(function (event) {
var callbackHandler = usePersistFn(function (event) {
var genGuard = genKeyFormater(keyFilter);

@@ -187,3 +188,3 @@

}
}, [keyFilter]);
});
useEffect(function () {

@@ -231,5 +232,5 @@ var e_2, _a;

};
}, [events, callbackHandler, typeof target === 'function' ? undefined : target]);
}, [events.join(''), callbackHandler, typeof target === 'function' ? undefined : target]);
}
export default useKeyPress;

@@ -1,6 +0,5 @@

/// <reference types="lodash" />
import { ThrottleOptions } from '../useThrottle/throttleOptions';
declare type Fn = (...args: any) => any;
declare function useThrottleFn<T extends Fn>(fn: T, options?: ThrottleOptions): {
run: T & import("lodash").Cancelable;
run: T;
cancel: () => void;

@@ -7,0 +6,0 @@ flush: () => void;

@@ -1,6 +0,5 @@

/// <reference types="lodash" />
import { DebounceOptions } from '../useDebounce/debounceOptions';
declare type Fn = (...args: any) => any;
declare function useDebounceFn<T extends Fn>(fn: T, options?: DebounceOptions): {
run: T & import("lodash").Cancelable;
run: T;
cancel: () => void;

@@ -7,0 +6,0 @@ flush: () => void;

@@ -11,4 +11,4 @@ "use strict";

var immediate = options === null || options === void 0 ? void 0 : options.immediate;
var timerRef = react_1.useRef();
timerRef.current = fn;
var fnRef = react_1.useRef();
fnRef.current = fn;
react_1.useEffect(function () {

@@ -20,3 +20,3 @@ var _a;

if (immediate) {
(_a = timerRef.current) === null || _a === void 0 ? void 0 : _a.call(timerRef);
(_a = fnRef.current) === null || _a === void 0 ? void 0 : _a.call(fnRef);
}

@@ -27,3 +27,3 @@

(_a = timerRef.current) === null || _a === void 0 ? void 0 : _a.call(timerRef);
(_a = fnRef.current) === null || _a === void 0 ? void 0 : _a.call(fnRef);
}, delay);

@@ -30,0 +30,0 @@ return function () {

@@ -20,2 +20,8 @@ "use strict";

var __importDefault = this && this.__importDefault || function (mod) {
return mod && mod.__esModule ? mod : {
"default": mod
};
};
Object.defineProperty(exports, "__esModule", {

@@ -27,2 +33,4 @@ value: true

var usePersistFn_1 = __importDefault(require("../usePersistFn"));
var dom_1 = require("../utils/dom"); // 键盘事件 keyCode 别名

@@ -189,3 +197,3 @@

callbackRef.current = eventHandler;
var callbackHandler = react_1.useCallback(function (event) {
var callbackHandler = usePersistFn_1["default"](function (event) {
var genGuard = genKeyFormater(keyFilter);

@@ -196,3 +204,3 @@

}
}, [keyFilter]);
});
react_1.useEffect(function () {

@@ -240,5 +248,5 @@ var e_2, _a;

};
}, [events, callbackHandler, typeof target === 'function' ? undefined : target]);
}, [events.join(''), callbackHandler, typeof target === 'function' ? undefined : target]);
}
exports["default"] = useKeyPress;

@@ -1,6 +0,5 @@

/// <reference types="lodash" />
import { ThrottleOptions } from '../useThrottle/throttleOptions';
declare type Fn = (...args: any) => any;
declare function useThrottleFn<T extends Fn>(fn: T, options?: ThrottleOptions): {
run: T & import("lodash").Cancelable;
run: T;
cancel: () => void;

@@ -7,0 +6,0 @@ flush: () => void;

{
"name": "ahooks",
"version": "2.7.0",
"version": "2.7.1",
"description": "react hooks library",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc