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

@restart/hooks

Package Overview
Dependencies
Maintainers
3
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@restart/hooks - npm Package Compare versions

Comparing version 0.4.13 to 0.4.14

6

cjs/useDebouncedCallback.d.ts

@@ -14,2 +14,5 @@ export interface UseDebouncedCallbackOptions {

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -23,2 +26,5 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -25,0 +31,0 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

12

cjs/useDebouncedCallback.js

@@ -7,2 +7,3 @@ "use strict";

var _useTimeout = _interopRequireDefault(require("./useTimeout"));
var _useEventCallback = _interopRequireDefault(require("./useEventCallback"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

@@ -13,2 +14,5 @@ /**

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -22,2 +26,5 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -33,2 +40,3 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

const lastArgsRef = (0, _react.useRef)(null);
const handleCallback = (0, _useEventCallback.default)(fn);
const {

@@ -86,3 +94,3 @@ wait,

lastInvokeTimeRef.current = time;
const retValue = fn(...args);
const retValue = handleCallback(...args);
returnValueRef.current = retValue;

@@ -123,5 +131,5 @@ return retValue;

};
}, [fn, wait, maxWait, leading, trailing]);
}, [handleCallback, wait, maxWait, leading, trailing]);
}
var _default = useDebouncedCallback;
exports.default = _default;

@@ -14,2 +14,5 @@ export interface UseDebouncedCallbackOptions {

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -23,2 +26,5 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -25,0 +31,0 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

import { useMemo, useRef } from 'react';
import useTimeout from './useTimeout';
import useEventCallback from './useEventCallback';

@@ -8,2 +9,5 @@ /**

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -17,2 +21,5 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

*
* > Heads up! debounced functions are not pure since they are called in a timeout
* > Don't call them inside render.
*
* @param fn a function that will be debounced

@@ -28,2 +35,3 @@ * @param waitOrOptions a wait in milliseconds or a debounce configuration

const lastArgsRef = useRef(null);
const handleCallback = useEventCallback(fn);
const {

@@ -81,3 +89,3 @@ wait,

lastInvokeTimeRef.current = time;
const retValue = fn(...args);
const retValue = handleCallback(...args);
returnValueRef.current = retValue;

@@ -118,4 +126,4 @@ return retValue;

};
}, [fn, wait, maxWait, leading, trailing]);
}, [handleCallback, wait, maxWait, leading, trailing]);
}
export default useDebouncedCallback;

2

package.json
{
"name": "@restart/hooks",
"version": "0.4.13",
"version": "0.4.14",
"main": "cjs/index.js",

@@ -5,0 +5,0 @@ "types": "cjs/index.d.ts",

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