use-latest-callback
Advanced tools
Comparing version 0.1.11 to 0.2.0
/** | ||
* 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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6024
80