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

use-latest-callback

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-latest-callback - npm Package Compare versions

Comparing version 0.1.11 to 0.2.0

3

lib/src/index.d.ts
/**
* React hook which returns the latest callback without changing the reference.
*/
export default function useLatestCallback<T extends Function>(callback: T): T;
declare function useLatestCallback<T extends Function>(callback: T): T;
export = useLatestCallback;
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var useIsomorphicLayoutEffect_1 = __importDefault(require("./useIsomorphicLayoutEffect"));
var React = require("react");
var useIsomorphicLayoutEffect_1 = require("./useIsomorphicLayoutEffect");
/**

@@ -49,2 +22,2 @@ * React hook which returns the latest callback without changing the reference.

}
exports.default = useLatestCallback;
module.exports = useLatestCallback;
{
"name": "use-latest-callback",
"version": "0.1.11",
"version": "0.2.0",
"description": "React hook which returns the latest callback without changing the reference",

@@ -5,0 +5,0 @@ "repository": "https://github.com/satya164/use-latest-callback",

@@ -8,3 +8,3 @@ import * as React from 'react';

// eslint-disable-next-line @typescript-eslint/ban-types
export default function useLatestCallback<T extends Function>(callback: T): T {
function useLatestCallback<T extends Function>(callback: T): T {
const ref = React.useRef<T>(callback);

@@ -25,1 +25,4 @@

}
// Use export assignment so that it's compiled to module.exports = useLatestCallback
export = useLatestCallback;

Sorry, the diff of this file is not supported yet

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